note 93774 added to function.mysql-query

From: Date: Mon, 28 Sep 2009 11:43:05 +0000
Subject: note 93774 added to function.mysql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-161123@lists.php.net to get a copy of this message
For those of you whom spent hours bashing your brains against the keyboard wondering why your non-English characters are output as question marks... Try the following: <?php $db = mysql_connect('YOUR_DB_ADDRESS','YOUR_DB_USER','YOUR_DB_PASS') or die("Database error"); mysql_select_db('YOUR_DB', $db); //SOLUTION:: add this comment before your 1st query -- force multiLanuage support $result = mysql_query("set names 'utf8'";); $query = "select * from YOUR_DB_TABLE"; $result = mysql_query($query); //-THE_REST_IS_UP_TO_YOU- ?> Simply run the query "set names 'utf8' " against the MySQL DB and your output should appear correct. ---- Server IP: 69.147.83.197 Probable Submitter: 118.21.141.133 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-query.php Edit -- https://master.php.net/note/edit/93774 Del: integrated -- https://master.php.net/note/delete/93774/integrated Del: useless -- https://master.php.net/note/delete/93774/useless Del: bad code -- https://master.php.net/note/delete/93774/bad+code Del: spam -- https://master.php.net/note/delete/93774/spam Del: non-english -- https://master.php.net/note/delete/93774/non-english Del: in docs -- https://master.php.net/note/delete/93774/in+docs Del: other reasons-- https://master.php.net/note/delete/93774 Reject -- https://master.php.net/note/reject/93774 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161123) next »