I have a couple of different databases I've created, we'll call "testdb1" and "testdb2." (I am using PHP 4.0).
I use the following standard code for the connection :
$db_name = "testdb1";
$conn = mysql_connect("localhost", "myname", "pword") or die ("Couldn't connect.");
$db = mysql_select_db($db_name, $conn) or die ("Couldn't select local database -- $db_name");
This works fine, of course.
But when I try to select the other database, "testdb2" I can't select it (it dies) :
$db_name = "testdb2";
$db = mysql_select_db($db_name, $conn) or die ("Couldn't select local database -- $db_name");
I can manipulate both databases from the MySQL monitor, so I know they are properly constructed. But the PHP script refuses to select anything other than testdb1! I'm out of ideas on this one. 😕