Avalanche Posted April 4, 2003 Share Posted April 4, 2003 Yes, I know, this should be in the tutorial help, but as I see not many people go there, so I thought I\'d post here. Anyways, I\'m creating the table users with all the fields, and here is my code: [php:1:923f2c57a2]<?php $conn=mysql_connect (\"localhost\", \"burnttoa_tehuser\", \"<mypasswordhere>\") or die (\'I cannot connect to the database because: \' . mysql_error()); mysql_select_db (\"burnttoa_tehdb\",$conn); $sql = \'CREATE TABLE `users` ( `userid` INT(25) NOT NULL, `first_name` VARCHAR(25) NOT NULL, `email_address` VARCHAR(25) NOT NULL, `username` VARCHAR(25) NOT NULL, `password` VARCHAR(255) NOT NULL, `info` TEXT NOT NULL, `user_level` ENUM(\'0\',\'1\',\'2\',\'3\') DEFAULT \'0\' NOT NULL, `signup_date` DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, `last_login` DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, `activated` ENUM(\'0\',\'1\') DEFAULT \'0\' NOT NULL, PRIMARY KEY (userid) ) TYPE = MYISAM COMMENT = \'Membership Information\';\'; if ($sql==FALSE) { print \"<code><b>error:</b> query1 failed.<br></code>\"; } else { print \"<code>query1 was successful.<br></code>\"; } mysql_close($conn); ?>[/php:1:923f2c57a2] It says the query was sucessful, but whenever I look at my databases it says there is no table there. Could somebody help? Quote Link to comment Share on other sites More sharing options...
shivabharat Posted April 4, 2003 Share Posted April 4, 2003 Hello buddy were is the mysql_query statement?? U have to give this command to execute the query Quote Link to comment Share on other sites More sharing options...
Avalanche Posted April 4, 2003 Author Share Posted April 4, 2003 Okay... [php:1:754b4a81ee]<?php $conn=mysql_connect (\"localhost\", \"burnttoa_tehuser\", \"<mypass>\") or die (\'I cannot connect to the database because: \' . mysql_error()); mysql_select_db (\"burnttoa_tehdb\",$conn); $sql = mysql_query(\"CREATE TABLE \'users\' ( \'userid\' INT(25) NOT NULL, \'first_name\' VARCHAR(25) NOT NULL, \'email_address\' VARCHAR(25) NOT NULL, \'username\' VARCHAR(25) NOT NULL, \'password\' VARCHAR(255) NOT NULL, \'info\' TEXT NOT NULL, \'user_level\' ENUM(\'0\',\'1\',\'2\',\'3\') DEFAULT \'0\' NOT NULL, \'signup_date\' DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, \'last_login\' DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, \'activated\' ENUM(\'0\',\'1\') DEFAULT \'0\' NOT NULL, PRIMARY KEY (userid), TYPE = MYISAM COMMENT = \'Membership Information\'\"); if ($sql==FALSE) { print \"<code><b>error:</b> query1 failed.<br></code>\"; } else { print \"<code>query1 was successful.<br></code>\"; } mysql_close($conn); ?>[/php:1:754b4a81ee] The query fails. What\'s wrong now? Quote Link to comment Share on other sites More sharing options...
shivabharat Posted April 4, 2003 Share Posted April 4, 2003 CREATE TABLE users ( userid INT(25) NOT NULL, first_name VARCHAR(25) NOT NULL, email_address VARCHAR(25) NOT NULL, username VARCHAR(25) NOT NULL, password VARCHAR(255) NOT NULL, info TEXT NOT NULL, user_level ENUM(\'0\',\'1\',\'2\',\'3\') DEFAULT \'0\' NOT NULL, signup_date DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, last_login DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, activated ENUM(\'0\',\'1\') DEFAULT \'0\' NOT NULL, PRIMARY KEY (userid), TYPE = MYISAM COMMENT = \'Membership Information\') Quote Link to comment Share on other sites More sharing options...
Avalanche Posted April 6, 2003 Author Share Posted April 6, 2003 Okay, thanks, but I just realized the tutorial said \"run the SQL statement with phpmyadmin\" not \"use phpmyadmin to make the table\". So I just ran the script (in the tutorial) instead and it works. Thanks for your time and effort, though. I appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.