note 93773 added to function.mysql-fetch-array

From: Date: Mon, 28 Sep 2009 11:41:20 +0000
Subject: note 93773 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-161122@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-fetch-array.php Edit -- https://master.php.net/note/edit/93773 Del: integrated -- https://master.php.net/note/delete/93773/integrated Del: useless -- https://master.php.net/note/delete/93773/useless Del: bad code -- https://master.php.net/note/delete/93773/bad+code Del: spam -- https://master.php.net/note/delete/93773/spam Del: non-english -- https://master.php.net/note/delete/93773/non-english Del: in docs -- https://master.php.net/note/delete/93773/in+docs Del: other reasons-- https://master.php.net/note/delete/93773 Reject -- https://master.php.net/note/reject/93773 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161122) next »