note 54214 deleted from function.mysql-insert-id by jacques

From: Date: Mon, 27 Jun 2005 20:34:38 +0000
Subject: note 54214 deleted from function.mysql-insert-id by jacques
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-91042@lists.php.net to get a copy of this message
Note Submitter: mark at dreamjunky dot com ---- Responding to ed at is-cool dot net... "Put something else in place such as "select count( id ) from table" before and after the mysql_insert_id() call to ensure that a row was inserted." Sound advice, but that method isn't entirely necessary. Just check the return value of mysql_query which, for inserts, will be false on error. if (mysql_query($insert_query)) { // select your insert ID safely } else { // error handling, etc } Mark

« previous php.notes (#91042) next »