954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

create table in sql using php code

i want to create a table in sql database using php code.
if i try to use the sql command(given below) in my php source code

"CREATE TABLE new_table(
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
id1 VARCHAR(55) NOT NULL
id2 VARCHAR(32) NOT NULL,
id3 CHAR,
PRIMARY KEY(id));"

i get syntax error ....
and with another code (below)

$sql = 'CREATE TABLE `database_name`.`new_table` (`ds` VARCHAR(2) NOT NULL) ENGINE = InnoDB';

it does'nt do anythng.....it does'nt add a new table....
where am i making the mistake......plzz help

ramseswar
Newbie Poster
22 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

well what syntax error do you get?

langsor
Posting Whiz
390 posts since Aug 2008
Reputation Points: 30
Solved Threads: 36
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You