----- Original Message ----- From: "Austin C" <galacticneo@xxxxxxxxx> To: <php-db@xxxxxxxxxxxxx> Sent: Friday, July 13, 2007 8:41 AM Subject: [PHP-DB] PHP & MySQL Issue! > Hello everyone, im trying to use PHP to create 2 tables in a database and > populate them with tables, however, it just wont work. Here is my full code: > > > <?php > $hostname = $_GET['hostname']; > $dbname = $_GET['dbname']; > $dbusername = $_GET['dbusername']; > $dbpassword = $_GET['dbpassword']; > $dbprefix = $_GET['dbprefix']; > > echo "<center><br><b>Install- Processing Database Info . . . . .</b> > <p> > <p>"; > > $cxn = mysqli_connect($hostname,$dbusername,$dbpassword,$dbname) > or die ("Basic Library System could not connect to the database you > specified. Please go back and make sure the information you submitted is > correct."); > > $file = '../config.php'; > > $fh = fopen($file, 'w') or die('Failed to open config.php file'); > > fwrite($fh, '<?php $hostname="'.$hostname.'"; > $dbname="'.$dbname.'"; > $dbusername="'.$dbusername.'"; > $dbpassword="'.$dbpassword.'"; > $dbprefix="'.$dbprefix.'"; ?>') or die('Could not write to config.php'); > > fclose($fh); > > mysqli_select_db($cxn,$dbname) are this should be mysqli_select_db($dbname, $cxn) ??? and the rest seem miss place in the function > or die ("Could not connect to the database you specified. Please go > back and make sure you entered the correct database."); > > mysqli_select_db($cxn,$dbname); > $sql = "CREATE TABLE ".$dbprefix."_circulation > ( > title varchar(100), > author varchar(100), > pubdate varchar(100), > genre varchar(100), > medium varchar(100), > price varchar(100), > id int(20) NOT NULL AUTO_INCREMENT, > PRIMARY KEY(id) > )"; > > mysqli_select_db($cxn,$dbname); > $sql = "CREATE TABLE ".$dbprefix."_holder > ( > space varchar(100) > )"; > > $query = mysqli_query($cxn,$sql); > if(!$query){ > echo "Basic Library System was unable to submit the information to the > database. Please make sure you specified correct information."; > }else{ > echo "Successfully created table. Do something here"; > } > > mysqli_close($cxn); > ?> > > > > ---------------------------------------------- > > Visit galacticwebdesigns.com for tutorials and more! >