foreach($_POST['100type'] AS $key=>$value) { // UPDATE 100 TYPE
mysql_query("UPDATE order_details_table SET block_quantity='{$_POST['100quantity'][$key]}', block_pallets='{$_POST['100pallets'][$key]}', block_extras='{$_POST['100extras'][$key]}' WHERE order_id='$id'")
or die(mysql_error());
}
the above code updates table data. It does not give me any errors but it does not update the table data. It fills in zero instead of the number it should be.
One has to be able to inspect the evidence. Change
mysql_query( "UPDATE order_details_table SET block_quantity='{$_POST['100quantity'][$key]}', block_pallets='{$_POST['100pallets'][$key]}', block_extras='{$_POST['100extras'][$key]}' WHERE order_id='$id'") or die(mysql_error());
to
$sql = "UPDATE order_details_table
SET block_quantity = '{$_POST['100quantity'][$key]}',
block_pallets = '{$_POST['100pallets'][$key]}',
block_extras = '{$_POST['100extras'][$key]}'
WHERE order_id = '$id'";
echo $sql;
mysql_query($sql) or die(mysql_error());
While this changes nothing, it lets you see the actual query sent to MySQL
hi,
thanks for the reply.
this is the sql statement that is echoed: UPDATE order_details_table SET block_quantity = ‘0’, block_pallets = ‘0’, block_extras = ‘0’ WHERE order_id = ‘40’
block_quantity is ‘0’ cause its the last value in the array. the problem is that the actual table is not updated properly. All records get the last value of the post
Why would one order have 12 sets of values? I’m not sure what you are doing but the foreach loop had a different purpose. Shouldn’t each order have a single set of values?