Reputation: 21
In our project we want to dynamic table creation of at the mysql database based on our dynamic form builder using. If it is possible or not please help me...
Upvotes: 1
Views: 1364
Reputation: 812
it is possible.you have to write query for create table like CREAT TABLE TABLENAME.... and run that query if table not exists in your database, in your server side php where you want to it.
Upvotes: 1
Reputation: 455
You need to learn mysql command. And use with php. Its basicly like this;
// Create table
$sql="CREATE TABLE Persons(FirstName CHAR(30),LastName CHAR(30),Age INT)";
// Create database
$sql="CREATE DATABASE my_db";
//Creating Specific tables (Primary Key and Auto Increment..)
$sql = "CREATE TABLE Persons
(
PID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(PID),
FirstName CHAR(15),
LastName CHAR(15),
Age INT
)";
Check it full example : http://www.w3schools.com/php/php_mysql_create.asp
And read this post, very helpfull for sql usage with php : How can I prevent SQL injection in PHP?
Upvotes: 1