Is it possible when an error occurs on the site:

mysql_connect (): Too many connections in ...

redirect to dr page (like: too many connections wait and refresh with timer)
Are there any other solutions?
What will give me @ before the connection, not a connection to the database? (could not catch)

Aborted_connects 839058
Connections 22353786
Max_used_connections 201
max_connections 200
max_user_connections 3
Threads_connected 7

  • 2
    depricated This extension is deprecated since PHP 5.5.0 and will be removed in the future. Use MySQLi or PDO_MySQL instead. See also the MySQL instruction: API selection and the corresponding FAQ for more details. Alternatives to this function: mysqli_connect () PDO :: __ construct () - zb '18
  • one
    Thank! I have been looking at PDO for a long time, I need to get started ... More than once I caught myself thinking that it was more convenient in many issues. - Freqnsy

1 answer 1

@ - suppresses error output, i.e. putting a dog in front of mysql_connect () you will not see - Too many connections
You can do this:

$my_connect = mysql_connect("host", "user", "password") or die("Ошибка соСдинСния: " . mysql_error()); print ("УспСшноС соСдинСниС с базой"); 

You can use the Sleep () function, pass it as a parameter how long to wait and perform its actions.
for example

 if (!$my_connect) sleep(10);//Π·Π°Π΄Π΅Ρ€ΠΆΠΊΠ° Π½Π° 10 сСк. reconnect(); //пСрСконСктится (ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΡΠΊΠ°Ρ функция) 
  • Ie if I put the dog then the crit will not be shown and there will be no connection to the database either? - Freqnsy
  • 2
    The dog just suppresses the output of the message to the browser, but no more. But connecting to the database will not help. - KoVadim
  • I already have mysql_connect ("host", "user", "password") or die ("Could not connect to MySQL server!"); - Freqnsy
  • one
    you must not die and do a thread header ("Location: defer.php"); exit; - zb '
  • Will it work? - Freqnsy