I am trying to execute the query to update the record in php.My php code is this:
$get_meals_info = "Select meal_id from orders WHERE order_id ='$order_id'";
$result = mysql_query($get_meals_info) or die(mysql_error());;
if(mysql_num_rows($result)!=0)
{
while($meal_id = mysql_fetch_assoc($result)) {
$id= $meal_id['meal_id'];
//$update_status="Select meal_id from orders where order_id=" . $meal_id['order_id'] . "";
$update_status = "update order_main SET STATUS='$order_status' WHERE id =" . $meal_id['meal_id'] . "";
$result = mysql_query($update_status);
//$meal_id=null;
echo $id;
}
I first get all the meal ids related to one order in my first select query and then i try to update the status for each meal using while loop but what i get only first meal record updated not the other one.I get this reponse:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\learning\service\update_order_status.php on line 13
true