I can't seem to get the following code to work in an event. The foreach loop only runs once even though the array should have 8 name/value pairs in it. then when I create a message from within the loop to test it, I get 7 as the value of $orders["id"] when it should be a value between 765 and 773 . any comments or help would be greatly appreciated.
if ($values["otype"]=="Roof"){
$strSQLselect = "select id from job_orders where job_id = '".$values["job_id"]."' and completed < '1'";
$rsMan = db_query($strSQLselect,$conn);
$order=db_fetch_array($rsMan);
foreach ($order as $orders) {
$sql = "UPDATE job_orders SET showit = '0' WHERE id = '".$orders["id"]."'";
db_exec($sql,$conn);
}
}