note 88502 deleted from function.mysql-error by danbrown
| From: | danbrown@php.net | Date: | Tue, 27 Jan 2009 13:53:26 +0000 |
| Subject: | note 88502 deleted from function.mysql-error by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149845@lists.php.net to get a copy of this message | ||
Note Submitter: strrev xc.noxeh@ellij
----
<?php
$db1 = mysql_connect('host1', 'user', 'pass');
$db2 = mysql_connect('host2', 'user', 'pass');
mysql_query("FAIL", $db1);
var_dump(mysql_error());
?>
The documentation is correct; but you wouldn't expect this.
You will get: string(0) ""
It returns the error on the last opened mysql connection: $db2; and there was no error there.
So if you give a connection resource to mysql_query() (or some other mysql_ function) make sure you
also give that resource to mysql_error().