Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in ajax_creditordebtororder_edit.php on line 327
weird thing is if i change the $retval variable to $xxx, it works
foreach($id as $value){
if ($value!=''){
$sql = "SELECT * FROM csim_$creditordebtorS" . "orderitem WHERE billid = '$value'";
//debug($sql);
$retval = DBQuery($sql);
if (!$retval){ systemlog($sql . '-' . mysql_error()); header("location:$creditordebtor"."order_update.php?msg=3[]Error Occured, Please Retry");}
while ($row = mysql_fetch_assoc($retval)) { //line 327
$sql = "INSERT INTO csim_$creditordebtorS" . "invoiceitem (ordr, refid, billid, product_code, description_1, description_2, $inoutnumber, unit_price, discount, dprice, dpricec, item_total) VALUES ('$order', '$value','$billid', '{$row['product_code']}', '{$row['description_1']}', '{$row['description_2']}', '{$row[$inoutnumber]}', '{$row['unit_price']}', '{$row['discount']}', '{$row['dprice']}', '{$row['dpricec']}', '{$row['item_total']}') ";
//debug($sql);
$retval = DBQuery($sql);
if (!$retval) { systemlog($sql . '-' . mysql_error()); header("location:$creditordebtor"."order_update.php?msg=3[]Error Occured, Please Retry");}
$order++;
}
}
}