Insertion Query into MySQL
Posted on 2004-11-15
Wonder if anyone can help.
I have a table I'd like to insert a row into using PHP. This table will be being used by a CMS, so at any point any no. of users could be inserting rows into it.
Once the code has done the insert, I'd like to get the recordID of the new row.
So I could: do a select on the table immediately following the insert to get the new recordID.
I can't 100% rely upon any auto-increment feature since someone else could have inserted a new row in between my inserting, then finding the new recordID using auto-increment.
Is there anything very handy in PHP like:
newRecordID = php_insert_row (insert parameters ....)
that returns the new record ID for me without relying upon auto incremenet and one that would mean I wouldn't have to write a cumbersome select query immediately post the insert?
This is PHP4 running wtih MySQL 3.x.
Thanks for any help,