Forum Moderators: coopster
something like
if ($mysql_max_connections) {
redirect('friendly_error.php');
}
i'm no php whiz but surely someone out there has achieved such a thing?
Actually it sounds as if you have error_reporting set on your LIVE site.
regardless of my permissions, surely there's a way to redirect the user to a designated "we'll be back shortly" page that can use my own stylesheets and such - just like a 404 page... or am i mistaken?
right now, the error is:
Warning: mysql_connect(): User database_user_name has already more than 'max_user_connections' active connections in /home/mysite/public_html/directory/database_file.php on line 20
Unable to connect to database server!
$dbconn=mysql_connect('host','user','passw'); if (!$dbconn) { header("Location: db_server_too_busy_now.html"); exit; } <edit>Oops! Beat me again, jatar_k!</edit>
[edited by: StupidScript at 11:32 pm (utc) on July 11, 2006]
$dbconn=mysql_connect('host','user','passw');
if (!$dbconn) {
header("Location: db_server_too_busy_now.html");
exit;
}
This would still display the error, which would then prevent the header being sent, as output will have been generated. But adding the "@" symbol should do the trick:
$dbconn=@mysql_connect('host','user','passw');
if (!$dbconn) {
header("Location: db_server_too_busy_now.html");
exit;
}
what about use in oscomm sites? the database calls seem a bit different.
from includes/database.php
query (is this the correct one?):
function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
global $$link;
or application_top.php
// make a connection to the database... now
tep_db_connect() or die('Unable to connect to database server!');
That's a custom function but I guess you could suppress errors by putting the "@" right in front of the function:@tep_db_connect() or die('Unable to connect to database server!');
is it still possible to incorporate
$dbconn=@mysql_connect('host','user','passw');
if (!$dbconn) {
header("Location: db_server_too_busy_now.html");
exit;
}
what would i put in place of $dbconn?