newbie, can't select a database...

wxdqz

New Member
Hi people,

I'm a newbie to PHP, but I'm getting on ok, and enjoying it, except for one little problem...
I can't select a database I just created. I can select another earlier database, but not the new one.

here's my code:

$connection = @mysql_connect("localhost", "woodbine", "tic01") or die("couldn't connect");

$db1 = mysql_select_db("testDB", $connection) or die("couldn't select test database");

if ($db1) {
echo "selected test database<br>";
}

$db2 = mysql_select_db("redDB", $connection) or die("couldn't select red database");

if ($db2) {
echo "selected red database<br>";
}

and here's what my browser is producing:

selected test database
couldn't select red database

So, you can see I'm getting a good connection to mysql, and I know the mysql_select syntax is good, because it works on 'testDB', oh and yes, redDB is the right string for the newer database.

I guess it must be something to do with user privileges but I'm not sure.

Any ideas greatly appreciated.

Cheers,

Woodbine.
 
Back
Top