Forum Moderators: coopster

Message Too Old, No Replies

Same database calls on two domains.

Yet only one works.

         

Eric_Lander

3:14 am on May 29, 2003 (gmt 0)

10+ Year Member



24 hours ago, both sites pulled content from a proprietary database server. Both sites, using the same script, worked perfectly fine.

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!

SinclairUser

3:25 am on May 29, 2003 (gmt 0)

10+ Year Member



It may be possible that your hosting company may have upgraded mysql or another piece of the puzzle that caused this to happen.

Basically, you just need to check all the things that have changed to find the culprit.

Chris.

Asandir

3:26 am on May 29, 2003 (gmt 0)

10+ Year Member



I'd try a simple, verbose script that simply connects to the database, and prints one row or variable.

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....?

Eric_Lander

3:36 am on May 29, 2003 (gmt 0)

10+ Year Member



Right now, I have the following. Asandir, i believe the section in bold would represent what you have, right?

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();

Asandir

3:45 am on May 29, 2003 (gmt 0)

10+ Year Member



Pretty much, except you could put one on the first db connection too, as well as the db select.
Try making it disgustingly verbose.

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....

Eric_Lander

3:52 am on May 29, 2003 (gmt 0)

10+ Year Member



Asandir,

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!

Asandir

3:57 am on May 29, 2003 (gmt 0)

10+ Year Member



Time to show script that to your host, and clear your throat accordingly.

Eric_Lander

3:59 am on May 29, 2003 (gmt 0)

10+ Year Member



Oh, I shall. :) Thanks!

Eric_Lander

1:25 pm on May 29, 2003 (gmt 0)

10+ Year Member



I woke up this morning to try the questionable scripts, and they're all working fine. It appears to have been an issue on the hosting provider's end.

Thanks again for your help Asandir, it was much appreciated.

lorax

2:08 pm on May 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



FWIW - I had a problem similar to this and discovered that my host had upgraded PHP. It took me a while to figure it out but once I knew what happened I reviewed the changelog and was able to upgrade my script. But - at least your site is up and running again.