Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default Database not connecting

    Two pages, database wont connect... whats the problem?

    PHP Code:
    <?
    /*===========================================*\
    //                             OurHabbo Systems                                  //
    //                   Copyright Lewis Bradish 2007                       //
    //                                                                                                     //
    //                            Licensed Version 1.0                               //
    //      www.ourhabbo.net - [email protected]   //
    \*===========================================*/
    /*------------------------------------------------------------------------*\
    | ****** NOTE REGARDING THE VARIABLES IN THIS FILE ****** |
    +---------------------------------------------------------------------------+
    | If you get any errors while attempting to connect to                  |
    | MySQL, you will need to email your webhost because we       |
    | cannot tell you the correct values for the variables                     |
    | in this file.                                                                                                      |
    \*------------------------------------------------------------------------*/
     
    $site_domain 'ourhabbo.net';
    $database_type 'mysql';
    $database_name 'ourhabbo_demo';
    $database_prefix '';
    $technical_email '[email protected]';
    $master_server_name 'localhost';
    $master_server_port 3306;
    $database_username 'ourhabbo_demo';
    $database_password 'demo';
    $admin_control 'admincp';
    $can_view_admin_log '1';
    $uneditable_users '';
    /*========================================================================*\
    //                   Copyright Lewis Bradish 2007 - This notice must remain in tact                        //
    \*========================================================================*/
    ?>
    PHP Code:
    <?
    /*===========================================*\
    //                             OurHabbo Systems                                  //
    //                   Copyright Lewis Bradish 2007                       //
    //                                                                                                     //
    //                            Licensed Version 1.0                               //
    //      www.ourhabbo.net - [email protected]   //
    \*===========================================*/
    include '../includes/config.php';
    include 
    '../includes/settings.php';
    function 
    error_mail($string)
    {
     
    $error_subject 'An error has been reported at $site_domain';
     
    $error_message 'An error was reported at $site_domain on the page  $_SERVER[PHP_SELF]<br><br>Error: $string';
     
    $mail mail($technical_email$error_subject$error_message"From: $site_domain <$contact_email>");
     if(
    $mail){ echo("SENT"); }
     die();
    }
    function 
    database_connect()
    {
     
    mysql_connect($master_server_name$database_username$database_password);
     
    mysql_select_db($database_name) or die(error_mail("Cannot connect to database"));
    }

    database_connect();

    /*========================================================================*\
    //                   Copyright Lewis Bradish 2007 - This notice must remain in tact                        //
    \*========================================================================*/
    ?>
    Anyone?
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  2. #2
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    Have you added the user to the database?
    Free Online Games And Videos:
    http://www.vincesgames.com



  3. #3
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    The files look fine to me, make sure the details are correct. Or, your function:
    PHP Code:
    database_connect(); 
    Could be incorrect.

  4. #4
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Yes -.-

    Heres the error;
    PHP Code:

    Warning
    mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using passwordNOin /home/ourhabbo/public_html/demo/includes/functions.php on line 27

    Warning
    mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using passwordNOin /home/ourhabbo/public_html/demo/includes/functions.php on line 28

    Warning
    mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/ourhabbo/public_html/demo/includes/functions.php on line 28 
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  5. #5
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Did you edit the 8908945645640560 config files?

  6. #6
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    You wha?
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  7. #7
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Quote Originally Posted by Sangreal View Post
    Yes -.-

    Heres the error;
    PHP Code:

    Warning
    mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using passwordNOin /home/ourhabbo/public_html/demo/includes/functions.php on line 27

    Warning
    mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using passwordNOin /home/ourhabbo/public_html/demo/includes/functions.php on line 28

    Warning
    mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/ourhabbo/public_html/demo/includes/functions.php on line 28 
    There's your problem, the file couldn't find functions.php, nor are the details in config.php correct. Edit them.
    Last edited by loserWILL; 16-12-2007 at 02:54 PM.

  8. #8
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    Quote Originally Posted by Sangreal View Post
    Yes -.-

    Heres the error;
    PHP Code:

    Warning
    mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using passwordNOin /home/ourhabbo/public_html/demo/includes/functions.php on line 27

    Warning
    mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using passwordNOin /home/ourhabbo/public_html/demo/includes/functions.php on line 28

    Warning
    mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/ourhabbo/public_html/demo/includes/functions.php on line 28 
    By the looks of it.. the password is incorrect.

    - Vince.
    Free Online Games And Videos:
    http://www.vincesgames.com



  9. #9
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Quote Originally Posted by loserWILL View Post
    There's your problem, the file couldn't find functions.php, nor are the details in config.php correct. Edit them.
    We see here in config.php;
    PHP Code:
    $site_domain 'ourhabbo.net';
    $database_type 'mysql';
    $database_name 'ourhabbo_demo';
    $database_prefix '';
    $technical_email '[email protected]';
    $master_server_name 'localhost';
    $master_server_port 3306;
    $database_username 'ourhabbo_demo';
    $database_password 'demo';
    $admin_control 'admincp';
    $can_view_admin_log '1';
    $uneditable_users ''
    And here in functions.php;
    PHP Code:
    function database_connect()
    {
     
    mysql_connect($master_server_name$database_username$database_password);
     
    mysql_select_db($database_name) or die(error_mail("Cannot connect to database"));

    We see all info needed is inputed, but for some reason functions wont get it from config, although config is included???
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  10. #10
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Herm, try this. All I did was remove $master_server_name. If that doesn't work, I'm not sure what the problem is. :S

    PHP Code:
    function database_connect()
    {
     
    mysql_connect($database_username$database_password);
     
    mysql_select_db($database_name) or die(error_mail("Cannot connect to database"));


Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •