hello,
My query is not working the way i want. I am trying to do this:
if work_done is "Yes" for all the item_id then SET order_ready to "Yes"
if work_done is "No" for 1 item_id then SET order_ready to "No"
the problem is on second query.
If there is 1 item, my query works. it sets to "Yes" but if there are more than 1 item, my query does not work.
This is my code.
My query is not working the way i want. I am trying to do this:
if work_done is "Yes" for all the item_id then SET order_ready to "Yes"
if work_done is "No" for 1 item_id then SET order_ready to "No"
the problem is on second query.
If there is 1 item, my query works. it sets to "Yes" but if there are more than 1 item, my query does not work.
This is my code.
PHP:
for ($i=0;$i<=count($item_id);$i++)
{
$query = mysql_query("UPDATE item SET worker_id = '".$worker[$i]."', item_done = '".$work_done[$i]."' WHERE item_id = '".$item_id[$i]."' ") or die(mysql_error());
if ($work_done[$i++] == "Yes")
{
$query = mysql_query("UPDATE orderr SET order_ready = 'Yes' WHERE order_id = '".$order_id."' ") or die(mysql_error());
}
else
{
$query = mysql_query("UPDATE orderr SET order_ready = 'No' WHERE order_id = '".$order_id."' ") or die(mysql_error());
}
}
Last edited:







