1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySQL Error - help please

Discussion in 'Programming' started by Site Owner, Jul 2, 2007.

  1. #1
    I get this error:
    My config file:
    <?
    //Database connection info
    $hostname = "localhost";
    $username = "username";
    $password = "password";
    $dbName = "dbname"; 
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database"); 
    @mysql_select_db( "$dbName") or die( "Unable to select database"); 
    
    ?>
    PHP:
    Server runs PHP version 4.3.11 and MySQL 5.0
     
    Site Owner, Jul 2, 2007 IP
  2. sadface

    sadface Peon

    Messages:
    6
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Wrong username and/or password? You could try and replace "localhost" with "127.0.0.1", i've had issues with that a couple of times.
     
    sadface, Jul 2, 2007 IP
  3. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It's unable to connect to the mysql socket which most likely means MySQL is not even running.
     
    InFloW, Jul 2, 2007 IP
  4. UnrealEd

    UnrealEd Peon

    Messages:
    148
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    which one of the two functions is causing the error? they both output the same.
    Maybe you just entered a wrong database name.

    BTW: you don't have to wrap the $dbName in quotes, it's allready a string.
     
    UnrealEd, Jul 2, 2007 IP
  5. Gangsta

    Gangsta Active Member

    Messages:
    145
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #5
    it seem that you entered wrong hostname
     
    Gangsta, Jul 4, 2007 IP