Mysql_query ("set names 'gbk
'") Or die (error (mysql_error ()));
$ Db = new mysqli ('192. 168.200.254 ', 'dxy', 'p0o9i8u7', 'pattern'); <br/> If (! $ DB) {<br/> // show error if we cannot connect. <br/> echo 'error: cocould not connect to the database. '; <br/>} else {<br/> // is there a posted query string? <Br/> If (isset ($ _ post ['querystring']) {<br/> $ querystring = $ db-> real_escape_string ($ _ post ['querystring']); </P> <p> // is the string length greater than 0? </P> <p> If (strlen ($ querystring)> 0) {<br/> $ db-> query ("set Character Set utf8 "); <br/> $ query = $ db-> query ($ query = "select patent_id, patent_name from list_id where patent_id like '% $ querystring % 'limit 6 "); <br/> if ($ query) {<br/> // while there are results loop through them-fetching an object (I like PhP5 BTW !). <Br/> while ($ result = $ query-> fetch_object () {<br/> echo "<li onclick = fill ('". $ result-> patent_id. "^ ". $ result-> patent_name. "');> ". $ result-> patent_id. "<br/> ". $ result-> patent_name. "</LI>"; <br/>}< br/>} else {<br/> echo 'error: there was a problem with the query. '; <br/>}< br/>} else {<br/> // dont do anything. <br/>} // There Is A querystring. <br/>} else {<br/> echo 'there shocould be no direct Access to this script! '; <Br/>}< br/>}