redarrow Posted November 6, 2007 Share Posted November 6, 2007 advance thank you... i am currently learning how to do php with mysql so i dont need to use the mysql console but the table dosent go on the database.. please help cheers.. no errors just the table dosent create cheers.... <?php $db=mysql_connect(" sec"," sec"," sec"); $query='CREATE DATABASE database_test'; $result=mysql_query($query)or die('<center><b>Database exists please delete database or change database name</b></center>'); mysql_select_db('database_test',$db)or die('could not select database'); $query2='CREATE TABLE members('. 'id INT NOT NULL AUTO_INCREMENT'.',PRIMARY_KEY(id))'; $result2=mysql_query($query2)or die("Table error"); echo"database created and tables"; mysql_close($db); ?> Link to comment https://forums.phpfreaks.com/topic/76196-php-with-mysql/ Share on other sites More sharing options...
redarrow Posted November 6, 2007 Author Share Posted November 6, 2007 tried it this way aswell but no luck the table wont create.... <?php // database connection... // 1. Conection 2. Username 3. Password $db=mysql_connect("sec","sec","sec"); // 1. The $query 2. CREATE DATABASE 3. databse name $query='CREATE DATABASE database_test'; $result=mysql_query($query)or die('<center><b>Database exists please delete database or change database name</b></center>'); mysql_select_db('database_test')or die('could not select database'); $query='CREATE TABLE members ('. 'id INT NOT NULL AUTO_INCREMENT,'.' PRIMARY_KEY(id))'; $result=mysql_query($query)or die("Table error"); echo"database created and tables"; mysql_close($db); ?> Link to comment https://forums.phpfreaks.com/topic/76196-php-with-mysql/#findComment-385597 Share on other sites More sharing options...
adam291086 Posted November 6, 2007 Share Posted November 6, 2007 i think you have this a little wrong. I am also new to php but after looking at http://www.w3schools.com/php/php_mysql_create.asp i can see some differences. Look throught the turtorial and try again. Link to comment https://forums.phpfreaks.com/topic/76196-php-with-mysql/#findComment-385599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.