Stuck on something

Results 1 to 3 of 3
  1. #1
    Newbie MiNdWaRp is offline
    MemberRank
    May 2007 Join Date
    2Posts

    Stuck on something

    Hi there!

    I've been stuck on getting one thing functioning correctly for a few days now. So far, I have a website for account creation up @ (0 players online)
    But, as you can see on the page, it just can't connect to the MySQL server. I've played around with all the settings I can think of to no avail. Any idea where the problem lies in this? Any help would be much appreciated.


  2. #2
    Newbie nfsnobody is offline
    MemberRank
    Sep 2006 Join Date
    Melbourne, AustraliaLocation
    6Posts

    Re: Stuck on something

    It's good to see a well thought out and non noobish post for once...


    Are you able to connect to your MySQL server from any other scripts/clients?


    Is it a remote connection or a local one?


    Post your connect line(s) (obviously removing all passwords :P).


    I'm unfamiliar with the frontend you're using, but do you know PHP well enough to put in an line like this after the mysql_connect()?


    Code:
    echo "\n\n<br /><b>Error: </b>".mysql_error()."<br />\n\n";

    Although none of these will fix your problem, they will all help work out the problem :).



    -nfsnobody

  3. #3
    Newbie MiNdWaRp is offline
    MemberRank
    May 2007 Join Date
    2Posts

    Re: Stuck on something

    Thanks for the quick reply!

    Q: Are you able to connect to your MySQL server from any other scripts/clients?
    A: Yes, I can connect through a client I use called SQLYog no problem as well as make any changes I need through it.

    Q: Is it a remote connection or a local one?
    A: It's a local connection, remote turned out to cause even more problems. lol

    Post your connect line(s) (obviously removing all passwords :P).
    Not sure if this is what you mean, but this is what I'm assuming you mean:

    $lang="en"; // Language ("en" - english, "ru" - russian, "tr" - turkish)
    $host="localhost"; // HOST for Mangos database
    $user="root" ; // USER for Mangos database
    $password="xxxxxx"; // PASS for Mangos database
    $db="mangos"; // NAME of Mangos database
    $hostr="localhost"; // HOST for Realm database
    $userr="root" ; // USER for Realm database
    $passwordr="xxxxxx"; // PASS for Realm database
    $dbr="realmd"; // NAME of Realm database
    $database_encoding = 'CP1251'; // Set encoding
    $img_base = "img/"; // Image dir
    $ongif = "img/on.gif";
    $offgif = "img/off.gif";
    $server = "localhost"; // Server adress (for realm status)
    $port = "8085"; // Server port (for realm status) 8085 or 3724

    -----------------------------------------------------------------------------

    class DBLayer
    {
    var $link_id;
    var $query_result;
    var $saved_queries = array();
    var $num_queries = 0;

    function DBLayer($db_host, $db_username, $db_password, $db_name)
    {
    $this->link_id = @mysql_connect($db_host, $db_username, $db_password, true);
    echo "\n\n<br /><b>Error: </b>".mysql_error()."<br />\n\n";
    if ($this->link_id)
    {
    if (@mysql_select_db($db_name, $this->link_id))
    return $this->link_id;
    else
    error('Unable to select database. MySQL reported: '.mysql_error

    (), __FILE__, __LINE__);
    }
    else
    error('Unable to connect to MySQL server. MySQL reported: '.mysql_error

    (), __FILE__, __LINE__);
    }

    Q: I'm unfamiliar with the frontend you're using, but do you know PHP well enough to put in an line like this after the mysql_connect()?
    A: Done. Appears to just add to the previous statements. Although I don't know much about PHP, it looks to me as though the 2nd listed variables aren't even declared. Could this be the problem? It can't really read db_username if there's no db_username declared previous to it, can it?



Advertisement