I am implementing a shopping website for food items. I have a cart for each of my visitor and in the cart, the details of their food items are fed. I have a field called Food_Name in my cart table and I have another table called food where I have Food_Name, Food_Id among other details. 
I am trying to retrieve the food id by using Food_Name in my cart table and performing a query to get the corresponding food id in my food table. However, I am not getting any result for my food item.
The query however works when I hardcode the value of one of my food name for e.g 'Vegetable Gratin' in the place of $foodCommand
Please help me. It's very important
Here is part of the code
$retrieveCart="SELECT * FROM cart WHERE cartNo='$cartNo'";
$res3=$conn->query($retrieveCart);
while($rowresult=$res3->fetch(PDO::FETCH_ASSOC))
{
    $foodCommand=$rowresult['Food_Name'];
    echo $foodCommand; //I get the correct food name
    $retrievefid = "SELECT Food_Id FROM food WHERE Food_Name='$foodCommand'";
    echo $retrievefid;
    echo "</br>";
    $foodresult = $conn->query($retrievefid);
    $roww= $foodresult->fetch(PDO::FETCH_ASSOC);
    $fid = $roww['Food_Id'];
    echo "fid is ".$fid;
    $qty=$rowresult['qty'];
    $fprice=$rowresult['Food_Price'];
    $odetails="INSERT INTO 
                                visitor_order_details(Food_Id,OV_Id,O_Qty,`Price_Paid(Rs)`) 
                        VALUES('$fid','$vid','$qty','$fprice')";
    $conn->exec($odetails);
}//endwhile 
Edit:
I am getting the following error:
Notice: Trying to access array offset on value of type bool in C:\xampp\htdocs\trial2\checkout.php on line 140
