次のような私のSQL文:
INSERT INTO foo (val1) VALUES('v1');      -- ID in first table
foo_id = SELECT last_insert_id();
INSERT INTO bar (val2) VALUES ('v2');     -- ID in second table
bar_id = SELECT last_insert_id();
INSERT INTO foobar (foo_id, bar_id, val3)
VALUES (foo_id, bar_id, 'text');          -- third table
上記は機能していませんfoo_id = statement。