3D Gallery with Great Artwork Imagine Logo with Three Colors Beach Cabin 3D Android Tablet with Different Screens Studio Apartment Red Figured Greek Vase on Blue Background Silver and Gold Flashlight Lake on Fire

RESTful Post: MySQL Database

Page 4

Create a Database

Overview

Learn to create a database with cPanel. Add a table and create columns with phpMyAdmin.

You'll create a database with cPanel, named db_test and a table within db_test named, TestColors. You'll define four columns named user, pwd, data and id. You'll assign the AUTO_INCREMENT feature to column id.

cPanel: MySQL Databases

Load cPanel. Select the icon next to MySQL Databases. When the Create New Database page displays, enter a database name. For this tutorial we'll just call it db_test. If you're not a user for the database then add a new user and password, on the same page.

cPanel MySQL Databases

cPanel: phpAdmin

Return to the cPanel page and select phpMyAdmin.

cPanel phpMyAdmin

phpMyAdmin

phpMyAdmin takes a few seconds to load. Within phpMyAdmin, under db_test select the New button to create a new table. For this example we'll name the table TestColors because we're just going to let users input their favorite color. The next section explains how to create the columns you see in the following structure tab:

phpAdmin create a new database

phpMyAdmin: Create Columns

Create four columns including an int named id and three VARCHAR types with length of 256. Name the columns, user, pwd, data and id.

phpAdmin create columns

When you're done, select the structure tab and you should see the following four columns.

phpAdmin create a new database

phpMyAdmin: AUTO_INCREMENT

Last assign the AUTO_INCREMENT feature to column id.

Select the check box next to the id column, then select the Change icon that displays a pencil. You should see the following page. If you don't see A_I, then scroll to the right.

Select the A_I column, which abbreviates, AUTO_INCREMENT. Now every time you add a row to the database, the id field will increase by one. Be sure you have selected None for the Default value of column, id.

phpAdmin AUTO_INCREMENTs

Summary

You learned to create a database with cPanel. You added a table and created columns with phpMyAdmin.

You created a database with cPanel, named db_test. You created a table within db_test. The table's name is TestColors. You created four columns named user, pwd, data and id. You assigned the AUTO_INCREMENT feature to column id.

Try It!

Try the Post to PHP example described in this tutorial.


Ads >
Create 3D Games: Learn WebGL Book 2 Simple Shaders: Learn WebGL Book 4
3D Programming for Beginners: Learn WebGL Book 1

for Web graphics!

Copyright © 2022 Amy Butler. All Rights Reserved.