|
Free
PHP Tutorials
|
![]() |
home |
Stay
at Home and Learn
|
|||||||||
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.
|
|||||||||
| 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:
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:
After you have typed a name for your new database, click the "Create" button. You will be taken to a new area:
In this new area, you can create a Table to go in your database. At the moment, as it says, there are No tables found in the database. But the database itself has been created. To create a new table, type a name for it in the box
at the bottom. You can also type a number for the Fields textbox.
The fields are the columns, remember, and will be things like first_name,
surname, address, etc. You can always add more later, but just type
4 in there. In fact, type it out exactly as it is below:
When you've finished, click the Go button. Another, more complex, area will appear:
<-- Back One Page Move on to the Next Part --> <--Back to the PHP Contents Page View all our Home Study Computer Courses
|
||||||||||