Jump to content

Help! Fatal error: Call to undefined function mysql_select_database()


Ruko

Recommended Posts

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);

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.