Home

How to Implement a Database in MySQL for HTML5 and CSS3 Programming

|
|  Updated:  
2016-03-27 10:14:30
HTML5 and CSS3 All-in-One For Dummies
Explore Book
Buy On Amazon

When you've got a SQL database, you can build a table for HTML5 and CSS3 programming. When you've defined a table, you can add data. When you've got data, you can look at it. Begin by building a table to handle the contact data.

Be sure you're logged into phpMyAdmin.

Be sure you're logged into phpMyAdmin.

The phpMyAdmin page will have your database name available in the left column.

Activate the database by clicking the database name in the left column.

Activate the database by clicking the database name in the left column.

If the database is empty, an Add Table page appears.

Create a new table using the phpMyAdmin tool.

Create a new table using the phpMyAdmin tool.

Now that you have a database, add the contacts table to it. The contacts database has four fields, so type a 4 into the box and let ’er rip.

Enter the field information.

Enter the field information.

Type the field names into the grid to create the table. You can’t see it, but you can select the index of contactID as a primary key. Be sure to add this indicator. Also set the collation of the entire table to ascii_general_ii.

Click the Save button and watch the results.

Click the Save button and watch the results.

phpMyAdmin automatically writes some SQL code for you and executes it.

Now, the left panel indicates that you're in the database, which has a table called Contact.

Now, the left panel indicates that you're in the database, which has a table called Contact.

After you define a table, you can add data. Click Contact in the left column, and you see the screen for managing the contact table,.

You can add data with the Insert tab, which gives a form, based on your table design.

You can add data with the Insert tab, which gives a form, based on your table design.

Add the record.

Choose Insert Another Row and click the Go button. Repeat until you've added all the contacts you want in your database.

Choose Insert Another Row and click the Go button. Repeat until you've added all the contacts you want in your database.

After you add all the records you want to the database, you can use the Browse tab to see all the data in the table.

About This Article

This article is from the book: 

About the book author:

Andy Harris earned a degree in Special Education from Indiana University/Purdue University–Indianapolis (IUPUI). He taught young adults with severe disabilities for several years. He also taught himself enough computer programming to support his teaching habit with freelance programming.
Those were the exciting days when computers started to have hard drives, and some computers connected to each other with arcane protocols. He taught programming in those days because it was fun.
Eventually, Andy decided to teach computer science full time, and he still teaches at IUPUI. He lectures in the applied computing program and runs the streaming media lab. He also teaches classes in whatever programming language is in demand at the time. He has developed a large number of online video-based courses and international distance education projects.
Andy has written several books on various computing topics and languages including Java, C#, mobile computing, JavaScript, and PHP/MySQL.
Andy welcomes comments and suggestions about his books. He can be reached at [email protected].