Page 1 of 1

Nothing returned from MySQL database :(

Posted: Sun Aug 17, 2008 6:47 am
by phpMonk
I wonder if anyone here can help...

I have a hosted PHP / MySQL site, coded by myself. I've had it for three years and it's been fine. Two months ago it started acting up.

(PHP Version 5.0.0RC3, MySQL 4.1.11)

What happens is that for period of between 20 minutes and several hours, it will fail to retrieve data from MySQL. I don't mean it will error, but it will simply retrieve no data (NULL). Then it will start working again.

This affects the whole site. To illustrate, this test page -

Code: Select all

<?php
 
    include("connectdb.php");
    
    $query="select count(*) totim from images";
    $res=mysql_query($query,$db);
    $row=mysql_fetch_array($res);
    $numim=$row["totim"];
    
    echo "Query of images table gives a total of $numim images<br><br>";
    if ($numim>0) {
        echo "The database is fine<br><br>";
    } else {
        echo "This shows that the data in the database is NOT available to my scripts!";
    }
    
    mysql_close($db);
?>
normally displays

Query of images table gives a total of 59 images

The database is fine


but when this problem is occurring it will display

Query of images table gives a total of 0 images

This shows that the data in the database is NOT available to my scripts!


When this happens the data is still there (going in via PHPMyAdmin), it's just that my site pages can't see it.

I've given my hosters (HOSTWAY) all the information, plus exact downtimes (it sends me an email when someone access the site and this problem is occurring) but they can't be bothered to even investigate the problem, let alone fix it. The upshot is I'm left with a site that doesn't work for several hours most days.

If anyone can suggest anything I'd be greatful if only to understand what might cause this.

I should stress that the PHP code and database is fine and has worked without issue for years. I haven't changed PHP.INI since last year and I've not been notified of any upgrades to PHP or MySQL (although that doesn't mean someone hasn't been messing around with either)

Any suggestions? :)

Re: Nothing returned from MySQL database :(

Posted: Sun Aug 17, 2008 8:49 am
by Bill H
Problem is pretty clearly with the host, and if they "can't be bothered to even investigate the problem" I would change to a new host.

Re: Nothing returned from MySQL database :(

Posted: Sun Aug 17, 2008 11:26 am
by phpMonk
Bill H wrote:Problem is pretty clearly with the host, and if they "can't be bothered to even investigate the problem" I would change to a new host.
Yep, it's definitely a host problem. I will be switching soon but because I need a bit of time to set up my site I can't do it as soon as I'd hoped. I was just posting here to see if anyone had encountered something similar.

It's been almost 7 weeks now and Hostway haven't done a single thing to help!