I'm reading this book, "Begining PHP5, Apache and MySQL web development", and in an exercise I am trying to delete a record. However I keep getting this error message;
Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE _id = '8' LIMIT 1' at line 2
|
This is the code that seems to be causing the problem
Code:
// generate SQL
$sql = "DELETE FROM " . $_GET['type'] . "
WHERE " . $_GET['type'] . "_id = '" . $_GET['id'] . "'
LIMIT 1";
This is exactly what is in the book, but I'm still getting an error. Could this mean something is not activated in my local php? some kind of setting on how SQL statements are sent or something?