How to Delete Records in PHP using MySQL

The code in the HTML/PHP markup would look something like:

<?php mysql_query("DELETE FROM yourtable WHERE yourfield='yourvalue' ")
or die(mysql_error()); ?>

This code deletes any record from the table named “yourtable” when that record’s field named “yourfield” is identically equal to “yourvalue”. The names of these objects will, of course, be replaced by the unique names that your set up uses.

Source: tizag.com – excellent tutorials on all kinds of coding, programming, and other technical stuff.

Posted under Freeware, MySQL, WebDev

This post was written by Content Curator on November 16, 2009

Tags: , , , , , , , , , , , , , ,