Ruko Posted April 3, 2010 Share Posted April 3, 2010 I need help. I just made my registration script and when I hit the submit button, I get this error: Fatal error: Call to undefined function mysql_select_database() in /home/ruko/chat-planet/flash-planet/do_reg.php on line 10 Line 10: $db = mysql_select_database($dbname, $connection); Quote Link to comment Share on other sites More sharing options...
ialsoagree Posted April 3, 2010 Share Posted April 3, 2010 $db = mysql_select_db($dbname, $connection); Keep in mind that this returns a bool, so $db will either be TRUE or FALSE. Quote Link to comment Share on other sites More sharing options...
Ruko Posted April 3, 2010 Author Share Posted April 3, 2010 Im kinda new to php and i got the script from a tutorial. Quote Link to comment Share on other sites More sharing options...
ialsoagree Posted April 3, 2010 Share Posted April 3, 2010 Im kinda new to php and i got the script from a tutorial. Well, hopefully my response addressed your problem, mysql_select_database isn't a function (unless you define it as one). However, PHP does have the built in function mysql_select_db: http://php.net/manual/en/function.mysql-select-db.php Quote Link to comment Share on other sites More sharing options...
Ruko Posted April 3, 2010 Author Share Posted April 3, 2010 fixed it and works! thanks man. Another (minor) problem in the registration script is when I hit the submit button with the form incompleted, i see this: Please fill in all the fields!Thanks for registering with us! Code (where the problem is): if($name == false || $pass == false || $pass_conf == false || $email == false){ echo "Please fill in all the fields!"; }; if($pass != $pass_conf){ echo "Passwords do not match!"; } else { $connection = mysql_connect($host, $dbuser, $dbpass); $db = mysql_select_db($dbname, $connection); $sql = "INSERT INTO user (username,password,email,ip) VALUES ($name, $pass, $email, $ip)"; $result = mysql_query($sql); echo "Thanks for registering with us!"; }; ?> I wrote it all out. Its a really messy script. Maybe you guys can fix all this? Quote Link to comment Share on other sites More sharing options...
Lukeidiot Posted April 3, 2010 Share Posted April 3, 2010 fixed it and works! thanks man. Another (minor) problem in the registration script is when I hit the submit button with the form incompleted, i see this: Please fill in all the fields!Thanks for registering with us! Code (where the problem is): if($name == false || $pass == false || $pass_conf == false || $email == false){ echo "Please fill in all the fields!"; }; if($pass != $pass_conf){ echo "Passwords do not match!"; } else { //rename submit to Form Submits name if(isset($_POST['submit'])){ $connection = mysql_connect($host, $dbuser, $dbpass); $db = mysql_select_db($dbname, $connection); $sql = "INSERT INTO user (username,password,email,ip) VALUES ($name, $pass, $email, $ip)"; $result = mysql_query($sql); echo "Thanks for registering with us!"; } }; ?> I wrote it all out. Its a really messy script. Maybe you guys can fix all this? Quote Link to comment Share on other sites More sharing options...
Ruko Posted April 3, 2010 Author Share Posted April 3, 2010 okay, thanks m8 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.