I've made a few modifications but still can't get it to work properly.
This is what i have now:
if ($_POST['client_name']){
include ("include/pm_dbconnect.php");
$find_db = mysql_select_db("pm_data_" . $_POST['client_name']);
if (!$find_db) {
mysql_create_db("pm_data_" . $_POST['client_name']);
include ("include/pm_dbconnect.php");
$select_db = mysql_select_db("pm_data_" . $_POST['client_name']);
$create_table = "CREATE TABLE pm_projects (
pm_project_id int(10) unsigned NOT NULL auto_increment,
client_id int(10) NOT NULL default '0',
pm_project_name varchar(100) NOT NULL default '',
pm_project_date timestamp(14) NOT NULL,
PRIMARY KEY (pm_project_id),
UNIQUE KEY pm_project_id (pm_project_id))
CREATE TABLE pm_categories (
pm_categories_id int(10) unsigned NOT NULL auto_increment,
pm_project_id int(10) NOT NULL default '0',
pm_categories_name varchar(255) NOT NULL default '',
PRIMARY KEY (pm_categories_id),
UNIQUE KEY pm_categories_id (pm_categories_id)
)";
$table_result = mysql_query($create_table);
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
If i remove one of the CREATE TABLE statements, eg:
CREATE TABLE pm_categories (
pm_categories_id int(10) unsigned NOT NULL auto_increment,
pm_project_id int(10) NOT NULL default '0',
pm_categories_name varchar(255) NOT NULL default '',
PRIMARY KEY (pm_categories_id),
UNIQUE KEY pm_categories_id (pm_categories_id)
)
it successfully adds the remaining table.
Any other ideas?
Cheers,
macca