Creating Tables and AutoNumber Fields


I want to know how can i create tables and autonumber fields in mysql using php code ? I am new to php and i am trying to learn please help!


First off, I would have to say you need to get a book and if this isn’t possible I would say you should start looking for some good tutorials on the net on PHP/MySQL, which I know there is.

Those are 2 good places to start your learning.

For your problem try something along the lines of:
$q = “create Table Table_name(col_one varchar(255),col_two int(15), col_three auto_increment primary key)”;

$result = mysql_query($q) or die("Error 001: " . mysql_error());
Now I am not exactly sure if the syntax is a 100% correct, but you should be able to shuffle your way along with the 2 sites I gave you and the code I gave you.

Database Design and basic info:

Basic SQL non-system specific:

More advanced SQL non-system specific:

Intro to PHP and databases:
check out “Creating Dynamic websites with PHP and MySQL” at in the tutorials/basics section

Sponsor our Newsletter | Privacy Policy | Terms of Service