Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-09-21
4
Medium Priority
?
1,589 Views
Last Modified: 2012-08-14
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.
0
Comment
Question by:Jaime Olivares
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
ldbkutty earned 1800 total points
ID: 12116829
$dbh=@mysql_connect ($hostName, $usr, $pwd);

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

@ suppresses the error.
0
 
LVL 3

Assisted Solution

by:scn
scn earned 200 total points
ID: 12116892
Set display_errors=Off  in php.ini will avoid any error display
0
 
LVL 32

Assisted Solution

by:ldbkutty
ldbkutty earned 1800 total points
ID: 12116894
0
 
LVL 55

Author Comment

by:Jaime Olivares
ID: 12116900
Oh, just like DOS batch files. Those where easy points.
Thanks,
Jaime.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question