note 93774 modified in function.mysql-query by visualmind
| From: | visualmind@php.net | Date: | Tue, 04 May 2010 13:21:41 +0000 |
| Subject: | note 93774 modified in function.mysql-query by visualmind | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168919@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.
--was--
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.
http://php.net/manual/en/function.mysql-query.php