Hello everyone,
I am trying to create a database and table at once which works fine when I omit the auto increment field, but when I try to create the database, table, and auto increment field, it doesn't work. And its pissing me off because its so simple. so please help
<?php
$con = mysql_connect("localhost","root","password");
mysql_query("CREATE DATABASE $db",$con);
mysql_select_db($db, $con);
$sql = "CREATE TABLE $tname('id' INT(6) NOT NULL AUTO_INCREMENT, 'field2' varchar(25) NOT NULL, UNIQUE('id'))";
mysql_query($sql,$con);
mysql_close($con);
?>