note 40239 added to function.mysql-insert-id
| From: | WayneTheisinger at rn2 dot php dot net | Date: | Thu, 26 Feb 2004 08:40:08 +0000 |
| Subject: | note 40239 added to function.mysql-insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65783@lists.php.net to get a copy of this message | ||
In response to treylane at example dot com.
It is very very very important that you put in an "or die" or some other form of error
handling.
Some scripts can fail invisibly and insert invalid data throughout your whole database because of
mysql_insert_id
inserting the last successful insertid rather than reporting that the last attempt failed.
example of an or die statement.
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
$EventID = mysql_insert_id();
----
Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40239
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40239&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40239&report=yes
Search -- http://master.php.net/manage/user-notes.php