Ray Hauge wrote:
Nathan Rixham wrote:
Ray Hauge wrote:
I've run into a bit of a sticky situation trying to connect to a
remote MySQL database. Here's the background:
Connecting from the command line on the web server works.
Connecting from a different vhost works.
There's no information in mysql_error. In fact,
mysql_select_db('db') or die(mysql_error()); doesn't produce any output.
The only way I know this isn't working is when I try to run a query,
the result resource is NULL.
If I copy the contents of the query and run it on the command line,
from the web server, I get the results I expected.
I manage both servers. I added the new login on the MySQL server and
also ran flush privileges. I've gone so far as to reboot both the
MySQL process and the apache process.
The versions of MySQL are slightly different 5.0.24a (web) vs
It's getting late and I'm just grasping for straws.
database server works - yes
user and login works locally - yes
user and login works remotely - yes
user and login works on box in question - yes
do mysql connections work for any host at all in php? - todo
is the mysql module for php installed - todo check phpinfo() output
is error reporting enabled - todo set error_reporting to E_ALL
does a simple query such as "show databases" return any results
is query properly formatted and are variables properly replaced in php
version - todo check
I'd reckon that by the time you've checked all the above - you'll have
your own solution :)
I'm not sure what the problem was. I think I was tired and trying too
hard to solve an issue that didn't exist. I was thinking that
var_export($db_conn) would display "MySQL Resource Id #1" or something
similar, but it was displaying "NULL". I took out all my debugging code
and it's working fine now.
easy done Ray, all too often I do the same things - "school boy" errors
in the early hours of the morning!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php