I would like to get auto_incr value of new entry while performing INSERT, and create the table field 'url' on the fly.
Example:
database table fields:
id,category,sex,age,url (i want to insert a url with the auto_incr at the end)
variables:
$category = employee;
$sex = male;
$age = 30;
INSERT INTO table VALUES(NULL,$category,$sex,$age,'mywebsite.com/employee-male-30-00000001')
note: assuming the newly inserted id is 00000001
I am currently inserting the new entry with a blank url, and then getting the mysql_insert_id(), and then updating the new entry with the url.
Is there a better way to accomplish this with just one database interaction?
解决方案
You can d