SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ghost-like Connection error

    Im halfway through making a login system to restrict access to certain pages.
    i have a main index, a backend page, and my auth page. But im getting a weird error:
    Can't connect to MySQL server on 'localhost' (10061)

    Im not trying to connect to any localhost, i have a page conn.php which connects to an external database, but the error only arises if i have that included on the backpage. If i dont include it i just get a blank page.
    The same conn file works fine on the index page :/

    Could this be to do with it already been connected from the index/login page?

  2. #2
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I should mention i looked on google, but it was only coming up with stuff about drivers, and actual installations of mysql, but couldnt find anything similar to my problem :/

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no one have any help

  4. #4
    SitePoint Zealot
    Join Date
    Oct 2005
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the included file that provides the connection on one page works on one scrip[t but not another, then you may want to show the code from both the file for which it works and that for which it doesn't work so that people on this site can compare the two.

  5. #5
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well basicaly i copied the code from the first page to make the second.
    PHP Code:
    <?php
    include("mimetype.php");
    include(
    "conn.php");
    include(
    "functions.php");
    include(
    "authenticate.php");
    dbConnect('L4suicide');
    ?>
    Only the authenticate line is different. Apart from mimetype is at the bottom on the backend page, otherwise i get the error appearing in the middle of my page type decloration.
    The page itself has changed, in the backend one i dont have any Sql.

  6. #6
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok i did some testing. I ran the auth page on its own, and it works fine, no errors.
    somehow the error is because i have authenticate.php included, which doesnt make any sense to me.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    dublin, Ireland
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if no host is specified may be it will try to connect to localhost?

    are there any variable that have the same name causing your 'host' setting to become overwritten?

    are all the files in the same directory? make sure you are including exactly the same files by putting an echo statement in the included file. Check that it shows up in subsequent pages

    Good luck.

  8. #8
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hrm, ok i found where it is. its in my auth page when i try and fetch some sql info

    PHP Code:
    //conn.php
    function dbGet($sql="") {
    $result mysql_query($sql) or die(mysql_error());
            
    $return mysql_fetch_array($result);
    return 
    $return;

    This is my sql get method

    PHP Code:
    //auth.php
        
    $sql"SELECT * FROM db_login WHERE xUsername='".$username."'";
        
    $login_info dbGet($sql); 
    Thats where it blows up. No other vars named same..

  9. #9
    SitePoint Zealot
    Join Date
    Jan 2006
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok i found it, and yes im an idiot
    if you notice in my includes list, i connect after i include the auth page


Bookmarks

Posting Permissions

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