I have the following SQL statement:
DELETE FROM Menu WHERE restaurantID = '2' AND foodID = '12';
And I keep getting the error "#1046 - No database selected" whenever I try to run it. I looked up example SQL statements on W3 Schools and it seems like my statement has all the necessary parts.
DELETE FROM your_database_name.Menu WHERE restaurantID = '2' AND foodID = '12';
this code can help you to interact with mysql and php
$link = mysqli_connect("localhost", "UserName","password", "databaseName");
$sql="delete from Table_name where restaurantID = '2' AND foodID = '12' ";
$del = mysqli_query($link, $sql);
mysqli_close($link);
if ($del) {
echo "deleted ";
} else {
echo "did not delete ";
}
Notice : that you run the server .
for your problem as I think You did not select the database
forget about that use the above code it is very simple.
I hope I cloud help you.
good luck