Help: mysql_select_db

Discussion in 'PHP' started by suitsubetter, Nov 1, 2005.

  1. #1
    Hi!

    I am setting up a script and I'm getting an error on mysql_select_db. (returns false) See script below. The message that appears is: Could not select database.

    I am sure the database name is correct in the setup (entersuk_InfiniteR) and cannot get what the problem is.

    Localhost, username and password is correct and there is no error on this.

    Any idea??


    function DB_connect() {
    global $MySQL_server, $MySQL_user, $MySQL_password, $MySQL_database;
    global $DB_LinkID, $blahtest;

    $DB_LinkID = mysql_connect($MySQL_server, $MySQL_user, $MySQL_password)
    or die("Could not connect : " . mysql_error());

    mysql_select_db($MySQL_database) or die("Could not select database.");
    return $DB_LinkID;
    }


    Tor
     
    suitsubetter, Nov 1, 2005 IP
  2. davediab

    davediab Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think the error lies here as simple as may seem
    $DB_LinkID = mysql_connect (should be no spaces) otherwise that looks fine unless you have the exact same code again on the page $db _link etc
    ps php mysql is bitchy

    hope this helps
     
    davediab, Nov 1, 2005 IP
  3. suitsubetter

    suitsubetter Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I found the problem...

    Thanx anyway :)
     
    suitsubetter, Nov 2, 2005 IP