Why is this database conn showing a Bool False?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Why is this database conn showing a Bool False?

Post by simonmlewis »

Code: Select all

     $resultuk = mysql_query ("SELECT id FROM products WHERE romancode = '$rowcat->romancode' AND paintedalternative IS NOT NULL", $dbuk);
     var_dump($resultuk);
print_r($resultuk);
[text]bool(false)[/text]
This should be showing nothing. When I do a 'count' of the results rows, it should be coming up as zero.

This page has a database connection to it's 'home' database, and is specifically querying it with ", dbsup, and that works without errors. So I don't think it is the db conn, as it's not erroring the connection.

If I query this in phpmyadmin, it comes up with zero rows.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Why is this database conn showing a Bool False?

Post by Celauran »

What does mysql_error() say?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Why is this database conn showing a Bool False?

Post by simonmlewis »

It seems to be looking at the 'home' database.... that doesn't make sense.

I'm doing this locally at the moment:

Code: Select all

$dbuk = mysql_connect("localhost","root","")or die ('Could not connect to site.co.uk');
mysql_select_db('site', $dbuk) or die ('Could not connect to site.co.uk Database');

$dbsup = mysql_connect("localhost","root","")or die ('Could not connect to jsupport.co.uk');
mysql_select_db('support', $dbsup) or die ('Could not connect to support.co.uk Database');
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply