note 44707 added to function.mysqli-query

From: Date: Fri, 13 Aug 2004 21:24:48 +0000
Subject: note 44707 added to function.mysqli-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-74581@lists.php.net to get a copy of this message
Use difference collation/character for connect, result. You can set the collation before your query. E.g. want to set the collation to utf8_general_ci you can send the query "SET NAMES 'utf8'" first <?php $mysqli=new mysqli('localhost', 'root', 'password', 'test'); $mysqli->query("SET NAMES 'utf8'"); $q=$mysqli->query("select * from test"); while($r=$q->fetch_assoc()) { print_r($r); } ?> There are many variables about character settings. By running sql command, SHOW VARIABLES LIKE 'char%'; There are some variables control the character usage. character_set_client character_set_connection character_set_database character_set_results character_set_server character_set_system Also SET NAMES can repalce with one or some settings like SET character_set_results='utf8'; ---- Manual Page -- http://www.php.net/manual/en/function.mysqli-query.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44707 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44707&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44707&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#74581) next »