note 90014 deleted from function.mysql-set-charset by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 08:04:22 +0000 |
| Subject: | note 90014 deleted from function.mysql-set-charset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196793@lists.php.net to get a copy of this message | ||
Note Submitter: humanclock dot com
----
Be careful when working with multiple databases via the same user/host that you specify
"true" as the fourth argument to mysql_connect(), otherwise when you call this function it
will set both db connections to the same character set.
If you don't pass in "true" to mysql_connect() in the example below, $link1 and
$link2 will have the same resource id# and both database connections will end up being set to utf-8
charsets.
<?php
$link1 = mysql_connect('localhost','user1','pass1',TRUE);
$link2 = mysql_connect('localhost','user1','pass1',TRUE);
mysql_selectdb('db1',$link1);
mysql_selectdb('db2',$link2);
mysql_set_charset('latin1',$link1);
mysql_set_charset('utf8',$link2);
?>