Home » Labs » PHP MySQL Delete  

PHP MySQL Delete


Filed under Labs

In some situation you need to delete the records from MySQL database. For example if a staff permanently quit the company or your company wants to removes some resellers etc., in such situation you can use The DELETE statement which quickly erases records from a MySQL table.

Syntax

<?php
DELETE * FROM tableName WHERE ID = SomeID
?>

PHP & MySQL Example Code

<?php
mysql_query("DELETE FROM Employees WHERE Name='Joy'");
or die(mysql_error());  
?>

Note: If you want to perform a large scale delete then It will be a wise choice to take a backup of Database before performing query.

Posts you may like: