URGENT. Hide warning message when I can't connect with my SQL server

Hi all,
I am experimenting troubles with my (ultra-cheap) mysql server. Connection string is:
  $dbh=mysql_connect ($hostName, $usr, $pwd);
  if ($dbh) {
       // etcetera

But when there is an database error I still want to show some information and avoid this warning message:

Warning: Too many connections in /var/apache/htdocs/tecnologico/index.php on line 16
Warning: MySQL Connection Failed: Too many connections in /var/apache/htdocs/tecnologico/index.php on line 16

I want to show a message like "Page in maintenance. Please try in some minutes." and an Icon.

How do I can avoid these annoying messages?

Thanks in advance.
LVL 55
Jaime OlivaresSoftware ArchitectAsked:
Who is Participating?
 
ldbkuttyConnect With a Mentor Commented:
$dbh=@mysql_connect ($hostName, $usr, $pwd);

if(!dbh) {
 
   // echo your warning message here,..
}

@ suppresses the error.
0
 
scnConnect With a Mentor Commented:
Set display_errors=Off  in php.ini will avoid any error display
0
 
Jaime OlivaresSoftware ArchitectAuthor Commented:
Oh, just like DOS batch files. Those where easy points.
Thanks,
Jaime.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.