Hi,

There is a problem in the MySQL extension when trying to get the errno, if
the connection failed, if a prior mysql_connect() call already succeeded:

mysql_connect('host', 'user', 'pw');
mysql_connect('host2', 'user2', 'pw2');
echo mysql_errno();
echo mysql_error();

Assuming the first call succeeds, but the second fails, then mysql_errno()
just returns 0, but it shouldn't.

That's because mysql_errno() uses the default_link for getting the errno
in this case.

There are two possible solutions:
1. set the default_link to -1 before makeing a new connection
2. change mysql_errno, with something like:
.... snip ...
case 1:
if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
if (MySG(connect_errno)!=0){
RETURN_LONG(MySG(connect_errno));
} else {
RETURN_FALSE;
}
}
id = -1;
break;
....

I think 1. would be the better solution because 2. is only a workaround,
or not?

thanx,
bye,
--
------------------------------- ----------------------------------
Michael Bretterklieber - [url]http://www.bretterklieber.com[/url]
JAWA Management Software GmbH - [url]http://www.jawa.at[/url]
Tel: ++43-(0)316-403274-12 - GSM: ++43-(0)676-84 03 15 712
------------------------------- ----------------------------------
"...the number of UNIX installations has grown to 10, with more
expected..." - Dennis Ritchie and Ken Thompson, June 1972

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: [url]http://www.php.net/unsub.php[/url]