Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Php PHP MySQL Delete


Share on Google+Share on Google+

PHP MySQL Delete

In SQL, sometimes we need to delete unwanted records from the table.

PHP MySQL Delete:


In SQL, sometimes we need to delete unwanted records from the table. SQL provides delete statement for this purpose. delete command can be used for delete one or more than one record at a time.

General format of the delete command is given as below:

delete from <table name>

where <condition>







die("Can not Connect".mysql_error());



echo "<br/> Before deletion :<br/>";

$result=mysql_query("select * from student");



echo $row['e_id']." ".$row['age']."<br/>";


mysql_query("delete from student where e_id='emp02'");

echo"<br/>After Deletion a record:<br/>";

$result=mysql_query("select * from student");



echo $row['e_id']." ".$row['age']."<br/>";




Before deletion :
emp01 26
emp02 27
emp05 26
emp_05 28
After Deletion a record:
emp01 26
emp05 26
emp_05 28


If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 17, 2009

Related Tutorials

Discuss: PHP MySQL Delete  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
isaac nyaata
September 12, 2012
coding skills

i like coding using php with c++. i see ur codes are just fine. after implementing i'll b back