18.5. Designing database applications with PHP (II)

18.5.1. Deleting records from a table

From the SQL discussion earlier in section 18.2, you learned that the following SQL statement can be used to remove a record from a table:

   DELETE FROM ... WHERE ...

To integrate this statement into a Web page, let’s develop a PHP page to delete records from a MySQL table. This page will display all records and each record has an underlined text DELETE attached to it. To delete a record, all you have to do is to click on the underlined text. The new record will be updated automatically. The coding of the page is listed below:

Example. ex18–52.php – Deleting Records From A Table
 1: <?PHP echo"<?";?>xml version="1.0" encoding="iso-8859–1"<?PHP echo"?>";?> ...

Get Practical Web Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.