Re: mysql_select_db() problem
| From: | Jeff Sheltren | Date: | Sat, 09 Feb 2002 20:30:58 +0000 |
| Subject: | Re: mysql_select_db() problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84132@lists.php.net to get a copy of this message | ||
It may be having a problem because you are not specifying which connection to use.
perhaps try something like this:
if(!$db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd"))
die("An Error Occured. Unable to connect to the database.");
if(!@mysql_select_db("$dbname",$db))
die("An Error Occured. Unable to find the database $dbname on the MySQL server.");
Hope that helps.
Jeff
At 09:24 PM 2/9/2002 +0100, 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 WilsonTel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8ZYWRHpvrrTa6L5oRArthAJ9Vew5DIKSR7qzc4M2abhxJfpz5TwCfRmZJ ZBn2oUXT4UgsH1hM/UyyNGs= =ajT+ -----END PGP SIGNATURE----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php