Php Tutorials

Submitted by: Submitted by

Views: 288

Words: 4058

Pages: 17

Category: Science and Technology

Date Submitted: 09/05/2012 02:01 PM

Report This Essay

PHP Tutorials

Creating a database using phpMyAdmin

You can create all of your database tables and queries using PHP code. But before doing that, it's a good idea to get an understanding of just what it is you'll be creating. If you're new to the world of databases, then here's a simple primer.

What is a database and what do they look like?

A database is a way to store lots of information. You might want to store the names and addresses of all your contacts, or save usernames and passwords for your online forum. Or maybe customer information.

When you create a database, you're creating a structure like this:

ID

Title

First_Name

Surname

1

Mr

Test

Name

2

Mrs

Second

Test

The columns (ID, Title, First_Name, Surname) are called Fields. The rows are called Records. Each record is a separate entry.

In a database, you save the information in a Table. A single database can contain many tables, and they can be linked together. When the tables are linked together, it's said to be a relational database. If you just have a single table in your database, then it's called a flat-file database. Flat-file database are easier to create and understand, so we'll start by creating one of these using phpMyAdmin.

So, if you have version 1.8 of EasyPHP, type http://127.0.0.1/mysql/ to bring up phpMyAdmin. However, if you have EasyPHP version 2.0, type http://127.0.0.1/home/mysql/ instead.

Although it looks a bit muddled, the part to concentrate on is the textbox under the words create new database, as in the next image:

[pic]

This is where you type a name for your database. We're going to create a simple Address Book, so type that into the textbox:

[pic]

After you have typed a name for your new database, click the "Create" button. You will be taken to a new area:

[pic]

PHP Tutorials

Setting up Fields in your phpMyAdmin database tables

You have four Fields in your table from the previous section. Although they are set out in rows in the...