|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-09 16:57 UTC] scottmac@php.net
[2007-10-09 21:58 UTC] carsten_sttgt at gmx dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 19:00:01 2025 UTC |
Description: ------------ Hello, mysqli->set_charset() only works after mysqli->real_connect(), but not after mysql_init(). BTW: I don't understand, why there is no MYSQLI_SET_CHARSET_NAME for mysqli->options()? Because that's the correct way, described in the MySQL C API. Regards, Carsten Reproduce code: --------------- ----- don't works ----- <?php $mysqli = mysqli_init(); $mysqli->set_charset('utf8'); echo 'Charset is: ', $mysqli->character_set_name(); $mysqli->real_connect('localhost','root','','test'); ?> ----- works ----- <?php $mysqli = mysqli_init(); $mysqli->real_connect('localhost','root','','test'); $mysqli->set_charset('utf8'); echo 'Charset is: ', $mysqli->character_set_name(); ?> Expected result: ---------------- Charset is: utf8 Actual result: -------------- Warning: mysqli::set_charset() [function.mysqli-set-charset]: invalid object or resource mysqli in \test.php on line 4 Charset is: Warning: mysqli::character_set_name() [function.mysqli-character-set-name]: invalid object or resource mysqli in \test.php on line 5