Forum Moderators: coopster
I have a table: id, name, id2
I would like to create a new record with values:
[new id (auto_increment), $name, the same id as the record's]
For now I do this in 3 querries:
1. INSERT INTO table(name) VALUES('$name');
2. $id = SELECT LAST_INSERT_ID(); (with normal mysql_querry, etc, not just like this)
3. UPDATE table SET id2='$id' WHERE id='$id';
How to do that all in one querry?
Thanks for any answers!
Michal Cibor
I think I'll stay with the original code, although it's not perfect. I have a bit of processing going on between 1. and 3 query.
Thanks again for the answer!
Best regards
Michal Cibor
BTW Welcome to WebMasterWorld!