Page 1 of 1

MySQL Tables

Posted: Mon Jul 15, 2002 9:16 am
by icesolid
How to I create MySQL tables trough PHP. I am looking for a command here, not a way of running a text file with the information. That I know how to. I was looking for a PHP command to do this.

Posted: Mon Jul 15, 2002 9:26 am
by qads

Code: Select all

mysql_create_table('tablename');

Posted: Tue Jul 16, 2002 1:45 am
by twigletmac
Unfortunately, mysql_create_table() doesn't exist (mysql_create_db() does although it is deprecated) instead you need to run an SQL statement containing the information required to create a table. Once you're connected to the database you could do something like:

Code: Select all

$sql = "CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10)))";
mysql_query($sql) or die(mysql_error());
Basically you would just use the SQL CREATE TABLE statement.

Mac