note 49621 deleted from function.mysql-query by philip

From: Date: Wed, 06 Apr 2005 17:55:06 +0000
Subject: note 49621 deleted from function.mysql-query by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87595@lists.php.net to get a copy of this message
Note Submitter: Shawn ---- I am having problems with the results returned using mysql_query() when the database field contains extended ASCII characters. If I perform a query within mysql the text appears as expected, but if I do it from within php using mysql_query() the extended ASCII characters are replaced with ? (question marks). For example, from within mysql: mysql>select * from items where stringID=4; displays the string: Précédent However, when I use the following PHP script: <?php $dbhost = "localHost"; $dbname = "mydb"; $dbuser = "mydbuser"; $dbpass = "mydbuserpassword"; $connection = mysql_pconnect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); $result = mysql_query("SELECT * FROM items WHERE stringID=4"); echo '<pre>'; echo 'result: ' . $result; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { printf("\nID: %s:%s String: %s", $row["stringID"], $row["itemID"], $row["itemString"]); } mysql_free_result($result); echo '</pre>'; ?> I get the following output: ID: 4:13 String: Pr?c?dent I would imagine the ?'s are UNICODE codes, but why don't they display?

« previous php.notes (#87595) next »