ak_mypayday Posted February 20, 2008 Share Posted February 20, 2008 Can someone tell me what the problem is with the script? I've got the database info correct but it won't select it. <?php $dbHost = "localhost"; $dbUsername = "getmacro_admin"; $dbPass = "KA_Kuy05"; $dbName = "getmacro_members"; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// $dbCon = @mysql_connect($dbHost, $dbUsername, $dbPass); if(!$dbCon) exit("Cannot make a connection to the database server.<BR>"); $dbSelect = @mysql_select_db($dbName); if(!$dbSelect) exit("Cannot select a database.<BR>"); ini_set("register_globals", "on"); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // Cleanly escape mysql values for direct insertion into a mysql_query ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if(!function_exists("quote_smart")) { function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } else { $value = "'" . $value . "'"; } return $value; } } extract(mysql_fetch_array(mysql_query("SELECT * FROM setupinfo"))); include("functions.php"); ?> Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/ Share on other sites More sharing options...
revraz Posted February 20, 2008 Share Posted February 20, 2008 You DB, ID or PW is wrong. Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472298 Share on other sites More sharing options...
ak_mypayday Posted February 20, 2008 Author Share Posted February 20, 2008 Nope that's not the problem. I created the database while updating the script. Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472301 Share on other sites More sharing options...
digitalgod Posted February 20, 2008 Share Posted February 20, 2008 try this $dbSelect = @mysql_select_db($dbName,$dbCon); if(!$dbSelect) die( mysql_error() ); Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472317 Share on other sites More sharing options...
ak_mypayday Posted February 20, 2008 Author Share Posted February 20, 2008 now i get a message that says "cannot connect to database server" this is the revised script <?php $dbHost = "localhost"; $dbUsername = "getmacro_admin"; $dbPass = "KA_Kuy05"; $dbName = "getmacro_members"; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE ///////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// $dbCon = @mysql_connect($dbHost, $dbUsername, $dbPass); if(!$dbCon) exit("Cannot make a connection to the database server.<BR>"); $dbSelect = @mysql_select_db($dbName,$dbCon); if(!$dbSelect) die( mysql_error() ); ini_set("register_globals", "on"); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // Cleanly escape mysql values for direct insertion into a mysql_query ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if(!function_exists("quote_smart")) { function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } else { $value = "'" . $value . "'"; } return $value; } } extract(mysql_fetch_array(mysql_query("SELECT * FROM setupinfo"))); include("functions.php"); ?> Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472323 Share on other sites More sharing options...
digitalgod Posted February 21, 2008 Share Posted February 21, 2008 ok so there is a problem with either your username, password or db name, when you created that db make sure you assigned to it a user Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472325 Share on other sites More sharing options...
ak_mypayday Posted February 21, 2008 Author Share Posted February 21, 2008 ok so there is a problem with either your username, password or db name, when you created that db make sure you assigned to it a user That couldn't be it. I've checked, I can install any other script, I just can't get this one to work. Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472341 Share on other sites More sharing options...
neylitalo Posted February 21, 2008 Share Posted February 21, 2008 Can you connect to other databases? Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472354 Share on other sites More sharing options...
ak_mypayday Posted February 21, 2008 Author Share Posted February 21, 2008 Yes with other scripts I can just fine. Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472366 Share on other sites More sharing options...
revraz Posted February 21, 2008 Share Posted February 21, 2008 Why do you use @ then use a die with a error? Makes no sense. Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472440 Share on other sites More sharing options...
ak_mypayday Posted February 21, 2008 Author Share Posted February 21, 2008 Thank you everyone! Problem resolved Link to comment https://forums.phpfreaks.com/topic/92199-please-help-error-message-cannot-select-database-please-help/#findComment-472502 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.