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

Member Avatar for langsor

well what syntax error do you get?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.