When I run an SQL query from PHP MyAdmin, it inserts the line correctly; when I run it from PHP, it does not.
I am going to provide you with the text in each; they are identical but given I might have missed something, I don't want to assume there are no differences;
IN PHP:
$orderSend = "SET @typeSQL := (SELECT `typeID` FROM `ArbuckleType` WHERE `typeName` = 'A la Carte');
SET @groupSQL:= (SELECT `groupID` FROM `ArbuckleGroup` WHERE (`groupName` = 'Nigiri' AND `typeID` = @typeSQL));
SET @itemSQL:=(SELECT `itemID` FROM `ArbuckleItem` WHERE (`itemName` = 'Salmon' AND `groupID` = @groupSQL));
INSERT INTO `ArbuckleOrderDetails` VALUES('', '$orderID', @typeSQL,@groupSQL, @itemSQL, '$quantity', '$spicy')";
mysql_query($orderSend);
Now in PHP MyAdmin:
SET @type := (SELECT `typeID` FROM `ArbuckleType` WHERE `typeName` = 'A la Carte');# MySQL returned an empty result set (i.e. zero rows).
SET @group:= (SELECT `groupID` FROM `ArbuckleGroup` WHERE (`groupName` = 'Nigiri' AND `typeID` = @type));# MySQL returned an empty result set (i.e. zero rows).
SET @item:=(SELECT `itemID` FROM `ArbuckleItem` WHERE (`itemName` = 'Salmon' AND `groupID` = @group));# MySQL returned an empty result set (i.e. zero rows).
INSERT INTO `ArbuckleOrderDetails` VALUES('', '$orderID', @type,@group, @item, '$quantity', '$spicy')
NOTE: I ran the PHP query WITHOUT the SET calls (the 3 lines setting the variables) and it worked; but I can't figure out where there is wrong syntax in those lines. Also ran mysql_error and it states that there is a syntax error - then asks me to look at the manual. Very helpful, mysql.