Re: note 27906 added to function.mysql-connect

From: Date: Tue, 24 Dec 2002 08:31:11 +0000
Subject: Re: note 27906 added to function.mysql-connect
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41251@lists.php.net to get a copy of this message
You *must* report bugs to bugs.php.net, otherwise they might go unnoticed and never fixed. Your note will be removed. Go to bugs.php.net and submit this info there w/ the details requested in the instructions you'll find at that site. --- melon@online.no wrote: > If you try to open a second connection with > mysql_connect() when you already have one open, you > don't get the proper error messages put in > mysql_error() and mysql_errno(). Tested with > version 4.1.2. Example: > > <?php > > // valid connection data > $host1 = "localhost"; $user1 = "bob"; $pass1 = > "password"; > // invalid connection data > $host2 = "localhoooost"; $user2 = "harry"; $pass2 = > "password"; > > echo "** Connect with valid data, all is fine:"; > > if(!($link1 = @mysql_connect($user1, $pass1, > $host1))) { echo mysql_error(); } > > echo "** No errors received. Connecting with > invalid data first time"; > > if(!($link2 = @mysql_connect($host2, $user2, > $pass2))) { echo mysql_error(); } > > echo "** No error messages received yet, closing > first link."; > > mysql_close($link1); > > echo "** First link closed, attempting to reconnect > with invalid data:"; > > if(!($link2 = @mysql_connect($host2, $user2, > $pass2))) { echo mysql_error(); } > > echo "** Error messages appear, like they should > have the first time."; > > ?> > > Output from this program: > > ** Connect with valid data, all is fine: > ** No errors received. Connecting with invalid data > first time: > ** No error messages received yet, closing first > link. > ** First link closed, attempting to reconnect with > invalid data: > Unknown MySQL Server Host 'localhoooost' (2) > ** Error messages appear, like they should have the > first time. > -- > http://www.php.net/manual/en/function.mysql-connect.php > http://master.php.net/manage/user-notes.php?action=edit+27906 > http://master.php.net/manage/user-notes.php?action=delete+27906 > http://master.php.net/manage/user-notes.php?action=reject+27906 > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto <jmcastagnetto@php.net> __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.notes (#41251) next »