Jump to content

Membership Tutorial Help


Avalanche

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/301-membership-tutorial-help/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/301-membership-tutorial-help/#findComment-951
Share on other sites

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\')

Link to comment
https://forums.phpfreaks.com/topic/301-membership-tutorial-help/#findComment-952
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.