strangermaster Posted June 12, 2008 Share Posted June 12, 2008 hi Server mysql 5/php5,2 I have a quaery working perfect in php myadmin : Select Name from Regions where Name like 'é%' order by Name ASC limit 0,5 for French or this one for russian : Select Name from Regions where Name like 'й%' order by Name ASC limit 0,5 But in my real systeme (ajax field autocomplete) it doesnot - only for normal latin characters ! No reponse att all in php : <?php //headers header("Content-Type: text/plein; charset=UTF-8"); header("Cache-Control: no-cache, private"); header("Pragma: no-cache"); //database information $sDBServer = ""; $sDBName = ""; $sDBUsername = ""; $sDBPassword = ""; $oData = json_decode($HTTP_RAW_POST_DATA); $aSuggestions = array(); //make sure there's text if (strlen($oData->text) > 0) { //create the SQL query string $sQuery = "Select Name from ".$oData->requesting." where Name like '".$oData->text."%' order by Name ASC limit 0,".$oData->limit; //make the database connection $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); @mysql_select_db($sDBName) or die("Unable to open database"); $query = "SELECT Name from ".$oData->requesting." where Name like '".$oData->text."%' order by Name ASC limit 0,".$oData->limit; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { array_push($aSuggestions,$row['Name']); } } //print_r($aSuggestions); //echo($oJSON->encode($aSuggestions)); echo(json_encode($aSuggestions)); echo($sQuery); ?> My data field in table is set to utf8_general_ci as i can see handeles well european, russian, latin caracters. Can your tell me what can be wrong ? As I have my page in utf-8 and the sql is well formed in my debug echo($sQuery); (at least on screen) Thanks Robert Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.