Another quickie
Date: 08/23/07
(PHP Community) Keywords: php, mysql, sql
Hello!
Just another quick question from me to you.
I simply need a little clarification on the mysql_insert_id() function that is available in PHP.
The definition on PHP.net reads: "Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query." Is this ID the number that is created in a column I defined (with Auto increment enabled) or is this something else entirely?
Say I have a table with two columns:
Column 1 = id_num (auto increment)
Column 2 = name
I want to insert a new name into the table and let the value for id_num generate automatically. Easy, right? Can I then call the mysql_insert_id() function and have it return the value in the first column that was created, or does it return a value that mysql uses but nobody else would need?
Source: http://community.livejournal.com/php/581426.html