How to delete a row from a MySQL database using PHP?

joseph

New member
I have a website and I need to delete a row from my database. Everything seems to be ok and when I run the script it shows no errors. Here is the script: mysql_query("DELETE FROM database WHERE id = '$_POST[id]'") or die(mysql_error()); . What is wrong with that script? I am the admin, and I have the privilege to use the DELETE MySQL command.
Thank you all for all your excellent answers. Although I do not know if it was a error in my script (I still changed it as you suggested) I found that my script that sent the POST, it sent it under a different array name... So in the end I really do not know what all happened, all I know is that my script works. In case anyone is interested my new script is: $sql = "DELETE FROM table WHERE id='.$_POST[id].'";
mysql_query($sql) or die(mysql_error()); . Thanks again for all your help!
 
Back
Top