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:
- set the default_link to -1 before makeing a new connection
- 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 - http://www.bretterklieber.com
JAWA Management Software GmbH - http://www.jawa.at
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