Online Shopping : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to
Did You Find This Entry Useful?

36 of 41 people (88%) answered Yes
Recently 8 of 10 people (80%) answered Yes


How can I create a table into a MySql database thru PHP?

Mar 21st, 2000 19:16
Ben Munoz, Preston Granbery, Nagesh Kumar,

The PHP function "mysql_query" can be used for more than just UPDATEs, 
INSERTs, DELETEs and SELECTs.  In particular:
mysql_query("CREATE TABLE table_name (create_definition, . . . )");
...should work.  
Note: You should, however, double check that the user connecting to the 
database (in your mysql_connect code) has permissions to create 
tables.  It normally will, but if not, look into the "GRANT" syntax in 
the MySQL online manual.