Re: Problem with creating parallel connections with mysql_connect
| From: | Bastien Koert | Date: | Wed, 18 Jan 2006 16:24:44 +0000 |
| Subject: | Re: Problem with creating parallel connections with mysql_connect | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41061@lists.php.net to get a copy of this message | ||
If no connection is made, there is no mysql error. You would need some custom error message output when the mysql_connect fails...
Bastien
From: Aarno Syvänen <as@gni.ch> To: David Robley <robleyd@ozemail.com.au> CC: php-db@lists.php.net Subject: Re: [PHP-DB] Problem with creating parallel connections with mysql_connect Date: Wed, 18 Jan 2006 15:30:44 +0100 I go following debug: got error <> when doing first connection resource id was Resource id #3 got error <> when selecting first database got error <> when doing second connection resource id was Resource id #4 got error <> when selecting second database the code was: $bid=mysql_connect($db_server,$db_user,$db_pass, $allow_multiple); //error_reporting ( $level); print "got error <" . mysql_error() . "> when doing first connection\n"; print "resource id was $bid\n"; mysql_select_db($db_db,$bid); print "got error <" . mysql_error() . "> when selecting first database \n"; //$level= error_reporting ( 0); $accid=mysql_connect($db_account_server,$db_account_user, $db_account_pass, $allow_multiple); print "got error <" . mysql_error() . "> when doing second connection \n"; print "resource id was $accid\n"; //error_reporting ( $level); mysql_select_db($db_account_db, $accid); print "got error <" . mysql_error() . "> when selecting second database\n"; So resource ids seem to be proper, and there is no errors either. Signup.php already tests $err:$err = mysql_error($accid); if($err=="") { echo ("<BR><BR><p>".lfunc ("signup_successful")."<BR><BR></p>"); } else { echo $err; }It branches to $err=="", when at same time reporting Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /var/www/bebbicell.ch/signup.php on line 213 This looks really strange. Aarno On 18 Jan 2006, at 11:14, David Robley wrote:On Wed, 18 Jan 2006 19:51, Aarno Syvänen wrote:Hi List, decided to try non-permanent connections for now. So now I have: <? /* db.php */ $db_server="127.0.0.1"; $db_user = "asterisk"; $db_pass = "bozzo984"; $db_db = "bebbicell"; $db_account_server="127.0.0.1"; $db_account_user = "asterisk"; $db_account_pass = "bozzo984"; $db_account_db = "asterisk"; $allow_multiple = "true"; //$level= error_reporting ( 0); $bid=mysql_connect($db_server,$db_user,$db_pass, $allow_multiple);echo mysql_error();//error_reporting ( $level); mysql_select_db($db_db,$bid);echo mysql_error();//$level= error_reporting ( 0); $accid=mysql_connect($db_account_server,$db_account_user,echo mysql_error();$db_account_pass, $allow_multiple); //error_reporting ( $level); mysql_select_db($db_account_db, $accid);echo mysql_error();?> Still I have same error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/bebbicell.ch/signup.php on line 212 Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /var/www/bebbicell.ch/signup.php on line 213 Offending statements are: $res = mysql_query($sql,$accid);echo mysql_error();$err = mysql_error($accid); Note that I use php-5.1.2RC1 compiled for Darwin Kernel Version 8.3.0 and Macintosh powerpc AarnoTry the above to find exactly where your problem is Cheers -- David Robley If I had anything witty to say, I wouldn't put it here. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php