MySQL connection failed. Trying to recover...
'; usleep(200000); $handler = @mysql_pconnect($db_server, $db_username, $db_password); if ($handler === FALSE) { header('Refresh: 10; URL='.$_SERVER['REQUEST_URI']); echo ''; echo '
The MySQL server is down or temporarily malfunctioning. Reload the page.
';
die();
}
}
mysql_select_db($db_database, $handler);
}
if (!function_exists('count_mysql_query')) {
function count_mysql_query($query, $hand, $reason='Unknown') {
global $cqs;
$cqs++;
$err = 0;
$rez = @mysql_query($query, $hand);
if ($err = @mysql_errno()) {
if ($err == 1062)
return $rez;
echo '
MySQL Error '.$err.' occured. Trying to recover...
';
@mysql_close();
SQLConnect();
$rez = @mysql_query($query, $hand);
$ere=0;
if ($ere = @mysql_errno()) {
@mail('your.email@example.com', 'MySQL Error: '.$err.','.$ere, $err.','.$ere.' occured at '.date('g:ia, F d (T)')." for query:\n".$query);
die('
Could not recover. Secondary error '.$ere.' occured.');
}
}
return $rez;
}
}
SQLConnect();
?>