asucrews Posted October 13, 2008 Share Posted October 13, 2008 The function not adding the table to my database...and i not sure why it not...anyideas? Function in Questions <?php public function addNewUser($username, $password, $email, $animelist){ $time = time(); /* If admin sign up, give admin user level */ if(strcasecmp($username, ADMIN_NAME) == 0){ $ulevel = ADMIN_LEVEL; }else{ $ulevel = USER_LEVEL; } $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time, '$animelist')"; return mysql_query($q, $this->connection); $q2 = "CREATE TABLE ".$animelist."(`id` int(4) NOT NULL auto_increment,`title` varchar(50) NOT NULL, `studio` varchar(50) NOT NULL,`yearmade` year(4) NOT NULL,`uslicensed` varchar(50) NOT NULL,`yearuslicensed` year(4) NOT NULL,`media` varchar(5) NOT NULL,`episodes` varchar(3) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;"; return mysql_query($q2, $this->connection); } php?> Link to comment https://forums.phpfreaks.com/topic/128170-function-not-adding-table-when-user-register/ Share on other sites More sharing options...
JasonLewis Posted October 13, 2008 Share Posted October 13, 2008 See how you have a return, then the create table. Well, anything after that won't be executed. So basically, remove that return in front of mysql_query(). Link to comment https://forums.phpfreaks.com/topic/128170-function-not-adding-table-when-user-register/#findComment-663821 Share on other sites More sharing options...
PFMaBiSmAd Posted October 13, 2008 Share Posted October 13, 2008 And creating a separate table for each user's data is poor database design. Link to comment https://forums.phpfreaks.com/topic/128170-function-not-adding-table-when-user-register/#findComment-663965 Share on other sites More sharing options...
DarkWater Posted October 13, 2008 Share Posted October 13, 2008 And creating a separate table for each user's data is extremely poor database design. I think you missed an adverb, so I fixed it for you. Link to comment https://forums.phpfreaks.com/topic/128170-function-not-adding-table-when-user-register/#findComment-663966 Share on other sites More sharing options...
asucrews Posted October 13, 2008 Author Share Posted October 13, 2008 Okay, then what best way to handle it? Link to comment https://forums.phpfreaks.com/topic/128170-function-not-adding-table-when-user-register/#findComment-663993 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.