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. 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"; } 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. Link to comment https://forums.phpfreaks.com/topic/239208-cannot-delete-rows/#findComment-1228971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.