I've been trying to add data into a table using specific queries. In PHPMyAdmin I've been using:
UPDATE member_food SET food_id ='5' WHERE member_id='5' AND food_type='breakfast'
this works, however when I try to implement it in PHP. It changed the food_id to 1.
Here is my PHP code:
$sql_breakfast1 = "UPDATE member_food SET food_id ='$breakfast1' WHERE member_id='$id' AND food_type='breakfast'";
if ($mysqli->query($sql_breakfast1) === TRUE) {
echo "Query: " . $sql_breakfast1;
} else {
echo "Query: " . $sql_breakfast1 . "<br> Error: " . $mysqli->error;
}
Here is my result when I echo Query:
Query: UPDATE member_food SET food_id ='8' WHERE member_id='5' AND food_type='breakfast'
For confirmation that I can send data to the table, if I do it without the AND part, it works. So this works:
Query: UPDATE member_food SET food_id ='8' WHERE member_id='5'
How do I debug this situation? What's the best way to tackle this?