PHP Delete Data From MySQL

Data can be deleted from MySQL tables by executing SQL DELETE statement through PHP function mysql_query. Below is a simple example to delete records into employee table. To delete a record in any table it is required to locate that record by using a conditional clause. Below example uses primary key to match a record in employee table.

Notice the WHERE clause in the DELETE syntax: The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!

Example -

Example -