Given the following block of code:
$q = "
BEGIN;
DECLARE User_ID int
INSERT INTO user (field1,field2) values (value1,value2);
set User_ID = select LAST_INSERT_ID();
INSERT INTO table2 (field1,field2) values (value1,LAST_INSERT_ID());
select User_ID
COMMIT;";
$sth = PDO::prepare($q);
$sth->execute();
How the heck to do I retreive the value "User_ID" ? fetch and fetchAll just return empty arrays, and there are no errors thrown in the process
EDIT 1 Sorry, should have been more clear... there is a second INSERT statement before returning the results.