mysql_query ("SET NAMES ' GBK '") or Die (Error (Mysql_error ()));
$db = new Mysqli (' 192.168.200.254 ', ' DXY ', ' p0o9i8u7 ', ' patent '); if (! $db) {//Show error if we cannot connect. Echo ' Error:could don't connect to the database. ' Else {/Be there a PO sted query string? if (Isset ($_post[' querystring ')) {$queryString = $db->real_escape_string ($_post[' querystring ']);//Is the string Length greater than 0? if (strlen ($queryString) >0) {$db->query ("Set CHARACTER set UTF8"); $query = $db->query ($query = "Select Patent_i D,patent_name from list_id where patent_id like '% $queryString% ' limit 6 '); if ($query) {//While there are results loop through them-fetching a Object (I like PHP5 btw!). while ($result = $query ->fetch_object ()) {echo ' <li onclick=fill ('. $result->patent_id. " ^^ ^ ". $result->patent_name."); > ". $result->patent_id." <br/> ". $result->patent_name." </li> "; } else {echo ' error:there is a problem with the query. '}} else {//Dont do anything.}//There is a querystring. else {echo ' therE should be no direct access to this script! '; } }