On Sat, 2002-02-09 at 12:24, Nick Wilson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all, 
> I just can't see what could possibly be wrong with my php here:
> 
>         $sel_db=mysql_select_db("mydb") or die 
>         ("could not get the bugger");
>         exit;
> 
> I can 'USE mydb' just fine from the command line so what's the problem?
>     (returns the die statement)
> 
> Much thanks..
> - -- 
> 
> Nick Wilson

I take it that the connection worked fine? (Yeah, dumb question, but you
never know.)

What do you get if you use error checking?

if (!$dbh = mysql_connect(. . .)) {
    echo "Could not connect; reason was " . mysql_error() . "\n";
    return false;
}

if (!$sel_db = mysql_select_db('mydb', $dbh)) {
    echo "Could not select database '$sel_db'; reason was " .
        mysql_error() . "\n";
    return false;
}

i.e. what do you get if you use mysql_error() after this fails?


Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to