I'm looking to enter in a whole object of information. The data itself needs to be put into different tables so I'm using a mysqli_multi_query
Query
for($i=0;$i<$commLength;$i++){
$sql = "INSERT INTO
calinfo (Sbefore, Safter, A1, A2, CalGas, Factor, Zbefore, Zafter, Cbefore, Cafter, SysInfoID)
VALUES
('{$comm[$i]->ScB4}', '{$comm[$i]->ScA4}', '{$comm[$i]->A1}', '{$comm[$i]->A2}', '{$comm[$i]->CalGasA}', '{$comm[$i]->Factor}', '{$comm[$i]->ZB4}', '{$comm[$i]->ZA4}', '{$comm[$i]->CalB4}', '{$comm[$i]->CalA4}', '{$comm[$i]->CHNoID}');";
$sql .= "UPDATE
jobs
SET
CompletedBy = $tech
WHERE JobID = '{$comm[$i]->JobID}';";
if(!mysqli_multi_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
else
{
$synctotal++;
}
}
I think I'm doing this wrong. All the data and values and being read correctly but I get this error code:
'Error: Commands out of sync; you can't run this command now'
Could someone point me in the right direction with this one please =)