Re: error-catching
| From: | Gert Mellak | Date: | Thu, 09 May 2002 16:05:31 +0000 |
| Subject: | Re: error-catching | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96825@lists.php.net to get a copy of this message | ||
really that easy? thank you...
gert.
Matthew Ward <email@inspirationstudios.co.uk> schrieb in im Newsbeitrag:
20020509151943.52621.qmail@pb1.pair.com...
> Simply use an if() statement to determine whether you are able to connect
to
> the database, and if not, display a message to say that its down, for
> example:
>
> <?php
> $db_connect = mysql_connect($db_server, $db_user, $db_pass);
> if(! $db_connect) {
> print("Could not connect to the database server, it may be down.");
> } else {
> $db_open = mysql_select_db($db_name, $db_connect);
> if(! $db_open) {
> print("Could not open the specified database.");
> }
> }
>
> ?>
>
> "Gert Mellak" <gert@mellak.com> wrote in message
> news:20020509140013.98456.qmail@pb1.pair.com...
> > Hi!
> >
> > When I open a database connection and i. e. the db-server is down,
> > I get a very long, long error message telling me that the server is
down.
> >
> > What I want to do is just echo a text, i. e. "DB-Server down" and leave
> out
> > the error message.
> >
> > Does anyone have an idea how to manage this?
> >
> > I'd be grateful for any information!
> >
> > TIA,
> >
> > Gert.
> > gert@mellak.com
> > http://mellak.com
> >
> >
> >
>
>