I use the following code for connection and selecting databases: $link = mysql_pconnect("localhost",$_SESSION['dbauser'],$_SESSION['dbapassword']) or die("Could not connect"); print "Connected successfully<P>"; mysql_select_db("stamps") or die("Could not select database");
This works. Regards Peter Goggin ----- Original Message ----- From: "PossumPal" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 03, 2002 4:40 AM 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php