|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-15 16:38 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 26 08:00:01 2025 UTC |
Description: ------------ php_mysql.dll (or php_mysqli.dll) extension do not use the same configuration as MySQL.exe, so if you run the same query from both sides you will not get the same results. I know I can use the following : @@mysql_query("SET NAMES 'utf8'",$my); on a fresh connection, but if the MySQL configuration changes I must have to change the php code as well. Reproduce code: --------------- PHP code : $rec=@@mysql_query("show Variables LIKE 'c___a%_%'",$my); while($row=mysql_fetch_assoc($rec)){ foreach($row as $n=>$v){ echo $v."\n"; } } MySQL code ; show Variables LIKE 'c___a%_%'; Expected result: ---------------- Mysql.exe results : Variable_name Value character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server utf8 character_set_system utf8 character_sets_dir ...\share\charsets\ collation_connection utf8_general_ci collation_database utf8_general_ci collation_server utf8_general_ci Actual result: -------------- php_mysql.dll results : Variable_name Value character_set_client latin1 character_set_connection latin1 character_set_database utf8 character_set_filesystem binary character_set_results latin1 character_set_server utf8 character_set_system utf8 character_sets_dir ...\share\charsets\ collation_connection latin1_swedish_ci collation_database utf8_general_ci collation_server utf8_general_ci