Forum Moderators: coopster
Then, out of the blue, one of the sites simply stopped reading information from the database.
The SELECT statements fot the database (mySQL) are exactly the same. It locates the server by IP, not by domain. It uses the same exact connection script. Yet still, only one works.
I took one page using the script from the working site, uploaded it to the problematic site... On the problematic domain, it simply hangs up on itself.
I'm relatively new to PHP and mySQL... But pages that worked perfectly fine 24 hours ago, and haven't been edited in some 72 hours - should still work if nothing has changed, right?
I've opened up a line of communication with my hosting company, but they're having difficulties understanding it.
So, I'm here. Left to ask, has this happened to anyone else before? What are some possible causes?
Thanks!
By verbose, I mean..
if (!mysql_connect($host, $user, $pass))
die('FATAL: cannot connect to mySQL server');
if (!mysql_select_db($database))
die('FATAL: cannot select MySQL database');
Assuming you don't have that there already....?
mysql_connect("location_of_database",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM table WHERE var = 'value' GROUP BY var2";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
Ie,
echo "<p>Opening db connection...";
mysql_connect("location_of_database",$username,$password) or die( "Unable to connect to database");
echo "<p>Selecting correct db...";
@mysql_select_db($database) or die( "Unable to select database");
echo "<p>Building query string...";
$query="SELECT * FROM table WHERE var = 'value' GROUP BY var2";
echo "<p>Querying...";
$result=mysql_query($query);
echo "<p>Fetching number of rows...";
$num=mysql_numrows($result);
echo "<p>Closing db connection...";
mysql_close();
If it's hanging, that might help isolate where....
I just tried that, and I'm getting nothing happening at all. The little icon in MSIE keeps on spinning around like it's trying to pull something... But it just shows nothing at all.
Meanwhile, I put it on the domain that is working, and it rendered the following message:
Opening db connection...
Selecting correct db...
Building query string...
Querying...
Fetching number of rows...
Closing db connection...
----------
So, it's obvious the script works. Just not on that server.
Thanks for your help on this. While I'm stil confused as to what could be happening, it's great to know someone is willing to help like this!