Creating Tables and AutoNumber Fields

Hello!

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!

Thanks!

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.

http://www.php.net
http://www.mysql.com

Those are 2 good places to start your learning.

For your problem try something along the lines of:
[php]<?
$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());
?>[/php]
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:
http://www.geekgirls.com/menu_databases.htm

Basic SQL non-system specific:
http://www.sqlcourse.com/

More advanced SQL non-system specific:
http://sqlcourse2.com/

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

Sponsor our Newsletter | Privacy Policy | Terms of Service