I want to write some values to two tables, then read the value immediately after, but this isn’t working. I have no idea why.
Here is my code:
// Transaction insert into two tables...
$insert_transaction = "
start transaction;
insert into Shipping.ShipmentHeader(SONum, User,DateofReq)
values('".{SalesOrderNo}."','".[usr_login]."', now());
select @NextRecNbr := max(RecNbr) from Shipping.ShipmentHeader;
insert into Shipping.ShipmentPackages(HeaderRecNbr,Length,Width,Height, Weight)
values(@NextRecNbr,".{Length}.", ".{Width}.", ".{Height}.", ".{Weight}.");
commit;
SELECT MAX(RecNbr) FROM Shipping.ShipmentHeader;
";
sc_lookup(rs1, $insert_transaction);
if (isset({rs1[0][0]})) // Row found
{
$ShipRateHeaderRecNbr = {rs1[0][0]};
}
else // No row found
{
echo "This Should not run ever";
exit;
}
I would expect to get the value into $ShipRateHeaderRecNbr… but instead its always going to the the else and I get “This Should not run ever”. Am I missing something here?