Welcome Guest, Not a member yet? Register   Sign In
Getting auto_increment value
#5

[eluser]johnmchilton[/eluser]
If you didn't use active record, you always want to use mysql_insert_id() in case somehow someone else besides the person invoking your script (using another script, or perhaps the same one) snuck in a database insert. imamiscool's method will get you the last record inserted no matter what, whereas mysql_insert_id() will get you the id resulting from the last insertion in the script and instance you're running.

http://us2.php.net/mysql_insert_id


Messages In This Thread
Getting auto_increment value - by El Forum - 07-08-2007, 05:43 PM
Getting auto_increment value - by El Forum - 07-08-2007, 05:46 PM
Getting auto_increment value - by El Forum - 07-08-2007, 05:53 PM
Getting auto_increment value - by El Forum - 07-08-2007, 07:01 PM
Getting auto_increment value - by El Forum - 07-08-2007, 07:30 PM
Getting auto_increment value - by El Forum - 02-11-2011, 05:28 PM
Getting auto_increment value - by El Forum - 02-11-2011, 07:27 PM
Getting auto_increment value - by El Forum - 02-11-2011, 07:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB