Imoddedu Posted April 5, 2009 Share Posted April 5, 2009 <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 More sharing options...
Ingolme Posted April 5, 2009 Share Posted April 5, 2009 You have this line wrong:mysql_select_db("TestLogins, $con");It should be like thismysql_select_db("TestLogins", $con); Link to comment Share on other sites More sharing options...
Imoddedu Posted April 5, 2009 Author Share Posted April 5, 2009 Got the same error. Link to comment Share on other sites More sharing options...
jlhaslip Posted April 5, 2009 Share Posted April 5, 2009 must be an error in the connection information.check the host, username and password. Link to comment Share on other sites More sharing options...
Ingolme Posted April 5, 2009 Share Posted April 5, 2009 Are you sure you wrote the database name correctly? Link to comment Share on other sites More sharing options...
Imoddedu Posted April 6, 2009 Author Share Posted April 6, 2009 Yes, I'm pretty sure. Link to comment Share on other sites More sharing options...
Imoddedu Posted April 6, 2009 Author Share Posted April 6, 2009 I fixed it. Link to comment Share on other sites More sharing options...
Synook Posted April 6, 2009 Share Posted April 6, 2009 How? Link to comment Share on other sites More sharing options...
Imoddedu Posted April 6, 2009 Author Share Posted April 6, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.