Delete data from database using PHP
How to delete data from database?
To delete data from mysql database we have write the below query.
The query to delete the all rows of a table from database :
$Query="DELETE FROM TABLE_name ";
This above query has no where condition so it will delete all the row of particular table "TABLE_name".
The query to delete the specific row of a table from database :
$Query="DELETE FROM TABLE_name where id='4' ";
This above query will delete only the row or record which will have id=4 .
Different Example of DELETE query are following.
$query= mysql_query("DELETE from students where roll_no=10");
$query= mysql_query("DELETE from articles where article_id=5 ");
Chapter Next »