BrianM Posted May 30, 2008 Share Posted May 30, 2008 To start things off, here is the code -- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>MPS - Send Client Data</title> </head> <?php $mysql_hostname = "localhost"; $mysql_username = "brian"; $mysql_password = ""; $mysql_database = "mps"; $mysql_connect = mysql_connect("$mysql_hostname", "$mysql_username", "$mysql_password") or die(mysql_error()); mysql_select_db("$mysql_database") or die(mysql_error()); $insert_one = "INSERT INTO mps_cdata (projectnumber, projectname, clientname, clientaddress, clientofficephone, clientfax, clientcell, clientemail) VALUES ('".$_POST['projectnumber']."','".$_POST['projectname']."','".$_POST['clientname']."','".$_POST['clientaddress']."','".$_POST['clientofficephone']."','".$_POST['clientfax']."','".$_POST['clientcell']."','".$_POST['clientemail']."')"; if (!mysql_query($insert_one, $mysql_connect)) { die(mysql_error()); } mysql_select_db("$mysql_database") or die(mysql_error()); $insert_two = "CREATE TABLE `".$_POST['projectnumber']."` ( ID tinyint not null auto_increment, PermitProcess varchar(40) not null, Required char(3) not null default 'N/A', SubmittalDate varchar(10) not null default '00-00-0000', CommentsReceivedDate1 varchar(10) not null default '00-00-0000', ResubmitDate1 varchar(10) not null default '00-00-0000', CommentsReceivedDate2 varchar(10) not null default '00-00-0000', ResubmitDate2 varchar(10) not null default '00-00-0000', CommentsReceivedDate3 varchar(10) not null default '00-00-0000', ResubmitDate3 varchar(10) not null default '00-00-0000', CommentsReceivedDate4 varchar(10) not null default '00-00-0000', ResubmitDate4 varchar(10) not null default '00-00-0000', ApprovalDate varchar(10) not null default '00-00-0000', PermitNumber varchar(10) not null default 'N/A', CoCReqDate varchar(10) not null default '00-00-0000', CoCSubmittalDate varchar(10) not null default '00-00-0000', primary key (ID) )"; mysql_query($insert_two, $mysql_connect); mysql_select_db("$mysql_database") or die(mysql_error()); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('COUNTY PRE-APP MEETING')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDOT PRE-APP MEETING')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('ERP PRE-APP MEETING')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('COUNTY PRELIMINARY PLAT APPROVAL')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('REZONING APPROVAL (BY OTHERS)')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('COUNTY CONSTRUCTION PLAN APPROVAL')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDOT DRIVEWAY CONNECTION PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDOT DRAINAGE CONNECTION PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDOT UTILITY PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('NOTICE TO R/W USERS')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDEP/ECUA SANITARY SEWER PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDEP/ECUA POTABLE WATER PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('SEPERATE UTILITY APPROVAL')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDEP/ERP STORMWATER PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDEP DREDGE & FILL PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('COE DREDGE & FILL PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('NPDES PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('ADEM PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FINAL PLAT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('FDEP/ERP CERTIFICATION OF COMPLETION')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('ERP REQUEST FOR CONVERSION TO OP. PERMIT')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('NPDES NOTICE OF TERMINATION')"); mysql_query("INSERT INTO `".$_POST['projectnumber']."` (PermitProcess) VALUES ('ADEM NOTICE OF TERMINATION')"); // change database for new report mysql_select_db("reports") or die(mysql_error()); $insert_three = "CREATE TABLE `".$_POST['projectnumber']."` ( ID mediumint(9) not null auto_increment )"; mysql_query($insert_three, $mysql_connect); ?> Your entry has been added to the database. Return <a href="http://www.game-zero.org/mps/home.php">home</a> or <a href="http://www.game-zero.org/mps/view_cdata.php">view client data</a>. <body> </body> </html> The part which isn't working for me is where I added in the comment // change database for new report This little snippet wont work... // change database for new report mysql_select_db("reports") or die(mysql_error()); $insert_three = "CREATE TABLE `".$_POST['projectnumber']."` ( ID mediumint(9) not null auto_increment )"; mysql_query($insert_three, $mysql_connect); But everything above it works just fine. Anyone see anything wrong with the code, what do I need to fix? =/ Link to comment https://forums.phpfreaks.com/topic/108055-solved-second-database-wont-create/ Share on other sites More sharing options...
BlueSkyIS Posted May 30, 2008 Share Posted May 30, 2008 mysql_query($insert_three, $mysql_connect) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/108055-solved-second-database-wont-create/#findComment-553875 Share on other sites More sharing options...
BrianM Posted May 30, 2008 Author Share Posted May 30, 2008 That's weird, it works now, but does the "or die(mysql_error());" really make that big a difference. I thought it was only used if I wanted to see why something doesn't work or debug purposes. Educate me, please. Link to comment https://forums.phpfreaks.com/topic/108055-solved-second-database-wont-create/#findComment-553886 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.