I am having trouble using user variables inside of a transaction. My problem is I want to insert into a table pull the auto_id from that insert in another query and store that in a user variable, then use that variable in the next insert into another table. When I commit the transaction I am getting that my user variables are NULL. Anyone have any suggestions on what I can do about this??
Mike mfg@elecchk.com
This tends to be database dependent. Which database are you using?
Sorry about that....pretty dumnb of me to leave out something like that mysql 4.0.3 using Innodb tables
Does mysql_insert_id not work?
I am using PEAR objects...so I believe that is out of the question. Plus I am using all three of these queries inside of a transaction like
start transaction; INSERT ()...... select @id:=LAST_INSERT_ID(); insert (id) values (@id); commit;