I want to insert multiple tables in same query with table2 retrieve the id from table1
Here's my sql code
$q = "
INSERT INTO Product (pName, pBrand, pCategory, pSize, pQuantity, pPrice, pDetail)
VALUES('$name', '$brand', '$category', '$size', '$quantity', '$price', '$detail');
INSERT INTO Image (iName, iExt, iSize, pID)
VALUES('$img_name', '$img_ext', '$img_size', LAST_INSERT_ID());";
$mysqli->query($q);
It shown the syntax error. but I copied the output of $q to Run in SQL query at phpMyAdmin it worked. Could you anyone point me out where is my mistake?
INSERT INTO Product (pName, pBrand, pCategory, pSize, pQuantity, pPrice, pDetail)
VALUES(....); #1 row affected
INSERT INTO Image (iName, iExt, iSize, pID)
VALUES(....); #1 row affected