trapping mysql query timeouts

A

Anonymous

Guest
One important detail is whether it's MySQL which is timing out, or if it's PHP that's timing out. I can't think of the way to do this in PHP off the top of my head, but I'm sure someone else will think of something.

If not, couldn't you just use JavaScript timer equal to the MySQL timeout length? Then if the data does come through, you can push out some JavaScript that will cancel the timer.

I'm curious what kind of query you're running that would cause PHP or MySQL to time out. I'm guessing your database could be optimized a bit more.
 
Well, if PHP is timing out, since there's no threading in PHP, then there's really nothing you can do.

I'm no good a JavaScript, either, but I can't imagine the solution would be very difficult.
 
you can do...

Code:
<script langauge="javascript">
function function_call() {
    document.write('Timedout');
}
window.setTimeout("function_call()", 30000);  /// 30 seconds... php timeout
</script>
<?php
flush();
//do the query,,
///..... and  other stuff
?>
 
Back
Top