Jump to content

No Database Selected


Imoddedu
 Share

Recommended Posts

<head><title>Register Test</title></head><body><?php$con = mysql_connect("----","----","---");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("TestLogins, $con");$sql="INSERT INTO logins (user, pass)VALUES('$_POST[user]','$_POST[pass]')";if (!mysql_query($sql,$con)){die('Error: ' . mysql_error());}echo "You have been registered!";mysql_close($con)?></body></html>

The problem is that it says no Database is selected. I have made the database TestLogins.

Link to comment
Share on other sites

mysql_select_db("TestLogins, $con");TestLogins was wrong. Apparently it is the same as the same in this bit of code

$con = mysql_connect("----","----","---");

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...