note 29257 added to function.mysql-errno

From: Date: Fri, 07 Feb 2003 14:20:54 +0000
Subject: note 29257 added to function.mysql-errno
Groups: php.notes 
Request: Send a blank email to php-notes+get-43565@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. -- http://www.php.net/manual/en/function.mysql-errno.php http://master.php.net/manage/user-notes.php?action=edit+29257 http://master.php.net/manage/user-notes.php?action=delete+29257 http://master.php.net/manage/user-notes.php?action=reject+29257

« previous php.notes (#43565) next »