Create Mysql Table

A database table name consists two parameters, one is table prefix and another is table name. prefix used for in single database consist two different application tables. for example any given database store A Application and B application data, then A application tables consist prefix a and another B application table name prefix is b.

Every table consists columns and rows. CREATE TABLE statement is used for create a mysql table. mysql table creation command require 3 parameters which is show below :

  • Name of the table
  • Name of fields
  • Definition and type of each fields

Create Table using PHP Script:

mysql_query function used for create Mysql table using php script. mysql_query function need two parameters for creating table and returns TRUE for success or FALSE for failure.

Syntax :

Create Table syntax :

Example :

Here show the basic php script example for creating mysql table with basic fields. please try below example code and create mysql table.

Now we will create table named “tbl_users”, with 4 columns : user_id, name, email, created_date.

Now create mysql table with the help of php script. below shows create table basic example code.