narjis Posted June 13, 2011 Share Posted June 13, 2011 I am trying to delete a row from my table by the following query $sql = mysql_query("DELETE FORM products WHERE id = '.$yesdelete."' LIMIT 1") or die(mysql_error()); but it gives the following mysql error 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 = '5' LIMIT 1' at line 1 The same error is coming in phpmyadmin. Please somebody help me. Quote Link to comment https://forums.phpfreaks.com/topic/239208-cannot-delete-rows/ Share on other sites More sharing options...
eMonk Posted June 13, 2011 Share Posted June 13, 2011 $sq1 = "DELETE FORM products WHERE id = '$yesdelete' "; mysql_query($sq1); if ($sq1) { echo "Row deleted"; } Quote Link to comment https://forums.phpfreaks.com/topic/239208-cannot-delete-rows/#findComment-1228967 Share on other sites More sharing options...
Muddy_Funster Posted June 13, 2011 Share Posted June 13, 2011 take the single quotes out from around $yesdelete - it's an integer field not a string. Quote Link to comment https://forums.phpfreaks.com/topic/239208-cannot-delete-rows/#findComment-1228971 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.