note 93773 deleted from function.mysql-fetch-array by danbrown
| From: | danbrown@php.net | Date: | Mon, 28 Sep 2009 16:42:09 +0000 |
| Subject: | note 93773 deleted from function.mysql-fetch-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161125@lists.php.net to get a copy of this message | ||
Note Submitter: Richie (at) RichieBartlett.com
----
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.