...

View Full Version : "Unable to select requested database."



johay
08-21-2006, 02:43 PM
i currenty run a game. Well just adding flies now and sorting it out etc..... but when i go to like online.php or anyother flie that the DB runs off.. i get "Unable to select requested database."

Can anyone tell me that problem?

Kid Charming
08-21-2006, 05:35 PM
That's not a listed MySQL error message. You need to use mysql_error() and/or mysql_errno() to find out what the server's error message is.

johay
08-22-2006, 01:43 PM
It actully come's from DB_connect.php:

<?php
$mysql_server = "localhost";
$mysql_user = "disaster";
$mysql_password = "*******";
$mysql_database = "disaster";





$connection = mysql_connect("$mysql_server","$mysql_user","$mysql_password") or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("$mysql_database") or die ("Unable to select requested database.");




?>

guelphdad
08-22-2006, 02:47 PM
Yes it does, but those are hand coded error messages. you could just as easily change those messages to "the moon is made out of green cheese" and that would show up. it doesn't tell you what the error is though.

change your code so it is the following:




$connection = mysql_connect("$mysql_server","$mysql_user","$mysql_password")
or die ("Unable to connect to MySQL server.") . mysql_error();
$db = mysql_select_db("$mysql_database")
or die ("Unable to select requested database.") . mysql_error();


you will now get proper error messages from mysql so you can diagnose what the problem is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum