note 29257 rejected from function.mysql-errno by nicos
| From: | nicos@php.net | Date: | Fri, 07 Feb 2003 14:29:27 +0000 |
| Subject: | note 29257 rejected from function.mysql-errno by nicos | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43567@lists.php.net to get a copy of this message | ||
just wanted to report a curious behaviour that involves my php/mysql installation (php 4.3.0 - mysql
3.23.51 on a win2k/iis5 server).
it seems that i can't detect a mysql error code by simply writing:
mysql_query($query) or die(mysql_errno()); // in case of an error, this outputs nothing
while everything works fine if i append/prepend some character or even an empty string to the die()
argument, like this:
mysql_query($query) or die(mysql_errno().""); // in this case it outputs correctly the
number of the error
i was trying to detect error #1062, when a user tries to insert a unique value twice, to provide a
friendly error message.
that's how i (hopefully) worked it out.