CMS takes the work out of building interactive websites.

Create a website at 000WebHost using PostNuke or other popular software.

Free Web Hosting
Installs instantly using the FANTASTICO script installer!!

Your site will have automatic features like member sign up and site search.

Features like message boards and chat are easily added.

PHP MySQL
Interactive Website Design

Delete a Record

The process of deleting a record makes use once again of the mysql_query function. It uses the SELECT method with the WHERE definition. The query form used to access this script would be similar to the one used for editing a record. A list of existing data would be displayed and below it a form to choose a line for removal. (See Example)

<?
$id=$_POST['id'];
$db="mydatabase";
$link = mysql_connect("localhost");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
mysql_query("DELETE FROM birthdays WHERE id=$id");
mysql_close($link);
?>

One fallacy of this simple script is that it will remove the id field as part of the record. That means that if you have 10 records and delete the record with id number 5, your existing id fields will be 1 to 4 and 6 to 10. The next time you add a record it will be added as 11 in the 5 spot.

Download the Scripts

The Birthdays Database management files can be downloaded in a zip file. The package contains an integrated db management system, with a simple login file and interface. To run the scripts on your PC you must have a localhost server installed along with PHP and the MySQL server.
Download birthdays_db.zip

MySQL Tutorial

To extend your knowledge of MySQL study the Docs and Tutorials at the official MySQL website. MYSQL.com

Updating data Free Web Hosting Altering Tables
PHP MySQL is a service provided by Net Success 2000 Plus Inc
PO Box 1508
Somerset, KY 42502
Last Modified: July 2, 2007

| HTML TOC | Web Design | Create a Website |

PHP MySQL - Interactive Website Design Copyright © 2007