Delete Data from Table using PDO

How to delete data from table using PDO?


The delete statement is used to delete the values from a table.

Syntax :

DELETE FROM tablename [WHERE where_condition];

The Delete statement deletes the rows from table and returns the number of rows deleted. The WHERE clause is used to specify the conditions that identify which rows to be deleted. If the DELETE query contains without WHERE clause, all rows will be deleted.

Example :

$sql = "DELETE FROM user_details WHERE email=''";
$count = $conn->exec($sql);

This is example for DELETE query.This query will delete the record of user_details where email=''.
Result :

PHP Topics

Ask Questions

Ask Question