New optional parameter to mysql_connect() in CVS

From: Date: Thu, 06 Dec 2001 10:10:30 +0000
Subject: New optional parameter to mysql_connect() in CVS
Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-3415@lists.php.net to get a copy of this message
Hi, I've added a new, optional parameter to mysql_connect() [NOT _pconnect yet!] of bool type which forces the creation of new links (in CVS). This is particular useful when use someone wants to access two different databases with the same user/password (doesn't currently work). I remember someone on these lists complained about this behaviour and I would kindly asked anyone interested in this trying it out (patch to PEAR::DB should be trivial) if it works well (done my own testing, but you never know). Short example: <? $link1 = mysql_connect('ficken', 'phptest1', 'phptest1'); var_dump($link1); mysql_select_db('phptest1', $link1); $result = mysql_query("SELECT * FROM php", $link1); var_dump($result); // $link2 = mysql_connect('ficken', 'phptest1', 'phptest1'); $link2 = mysql_connect('ficken', 'phptest1', 'phptest1', true); var_dump($link2); mysql_select_db('phptest2', $link2); $result = mysql_query("SELECT * FROM perl", $link2); var_dump($result); $result = mysql_query("SELECT * FROM php", $link1); var_dump($result); ?> Without the 'true' parameter to mysql_connect() the last sql statement won't work as expected (because the datbase change with $link2 also affects $link1). - Markus -- Please always Cc to me when replying to me on the lists.

« previous php.pear.dev (#3415) next »