Re: mysql_select_db problem

From: Date: Sun, 02 Jun 2002 21:26:47 +0000
Subject: Re: mysql_select_db problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-100331@lists.php.net to get a copy of this message
Do some error checking. You're turning off all the errors produced by the mysql statements, so how are you supposed to know what's wrong? You could also try: $db = mysql_select_db($db_name) or exit(mysql_error()); I'm not sure if mysql_error works for selecting the db, but it couldn't hurt to try :-) Cheers, # Nathan ----- Original Message ----- From: "PossumPal" <possumpal@hotmail.com> To: <php-general@lists.php.net> Sent: Sunday, June 02, 2002 12:40 PM Subject: [PHP] mysql_select_db problem Hi, I'm a newbie, so please have mercy on my silliness... I've checked my formats, and can't seem to understand why I can connect to the db, but not select the db that I want to use. The following code always returns the "Couldn't select database" error. If I use the mysql monitor, I can select the database directly without any problems. Could someone point out what I'm missing? <? $db_name="mydb"; $table_name="my_table"; $connection = @mysql_connect("localhost", "user", "password") or die ("Couldn't connect."); $db = @mysql_select_db($db_name) or die ("Couldn't select database"); ?> Regards, Carol

« previous php.general (#100331) next »