mysql_select_db error
| From: | Steven James Samuel Stapleton | Date: | Sun, 31 Oct 2004 04:19:12 +0000 |
| Subject: | mysql_select_db error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-200747@lists.php.net to get a copy of this message | ||
Relevant information:
Windows XP Pro SP2
PHP 5.0.2
MySQL 4.0.21-nt
command line (not server-side)
mysql_select_db returns no errors, and does not result in a mysql_error(), however, later queries result in errors suggesting that the switch failed:
//I'm having problems with mysql_select_db("DBNAME", resource) and
$test = mysql_query("use DBNAME", $resource);
//This results in no errors (I checked to make sure a true value was returned,
//and made sure mysql_errno() returned 0).
if(!$test || mysql_errno())
{
die("Error selecting DB");
}
//next, I'll make a query:
mysql_query("create table foo ( bar int, morebar int )", $resource);
if(mysql_errno())
{
die(mysql_error());
}
//I get
//No Database Selected
There appear to be quite a few related/similar posts, but I can't find any that address this particular variant of the problem, which are solved.
Thanks
-Jim Stapleton