1. Home
  2. Computing & Technology
  3. PHP / MySQL

Simple Address Book

By Angela Bradley, About.com

1 of 6

The Database

This tutorial will walk you through creating a simple address book using PHP and MySQL.

Before we can begin we need to decide what fields we wish to include in our address book. For this demonstration we will use Name, E-mail and Phone number, although you can modify it to included more options if you like.

To create this database we need to execute this code:

CREATE TABLE address (id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), phone VARCHAR(30), email VARCHAR(30)); INSERT INTO address (name, phone, email) VALUES ( "Alexa", "430-555-2252", "sunshine@fakeaddress.com"), ( "Devie", "658-555-5985", "potato@monkey.us" )

This creates our database fields, and puts in a couple of temporary entries for us to work with. We are creating four fields. The first is a self incrementing number, then name, phone and email. We will use the number as a unique ID for each entry when editing or deleting.

1 of 6

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Step By Steps
  5. Address Book - Online Address Book - PHP Address Book

©2008 About.com, a part of The New York Times Company.

All rights reserved.