On Sun, 31 Oct 2004 00:19:12 -0400, Steven James Samuel Stapleton
<[EMAIL PROTECTED]> wrote:
> 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:
No errors, that's correct, but it does return a boolean value. So are
you testing that return value?
if( mysql_select_db('foo') !== true ) die('cannot select db');
> //I'm having problems with mysql_select_db("DBNAME", resource) and
> $test = mysql_query("use DBNAME", $resource);
You might want to try killing it right there with something like:
$test = mysql_query() || die('bad query: ' . mysql_error());
> //This results in no errors (I checked to make sure a true value was
> returned,
mysql_query() returns a resource handler, not a boolean value.
> //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
$test = mysql_query() || die('bad query: ' . mysql_error());
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php