Re: Help with displaying rest of page after MySQL error
| From: | JJeffman | Date: | Sat, 17 Mar 2001 17:03:11 +0000 |
| Subject: | Re: Help with displaying rest of page after MySQL error | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7565@lists.php.net to get a copy of this message | ||
Get the "die" statement off, and check if your query succeeds, if no, let
the
rest of script go ahead :
$db = @mysql_pconnect (....);
if( $db){
$query = """;
....
}
// here goes the rest
HTH
Jayme.
-----Mensagem Original-----
De: Chris Vargas <ceenvee@yahoo.com>
Para: <php-db@lists.php.net>
Enviada em: sexta-feira, 16 de março de 2001 22:12
Assunto: [PHP-DB] Help with displaying rest of page after MySQL error
> This has to be a basic question but I can't find it
> answered anywhere; I'm probably not searching for the
> right words or something.
>
> I have a page that inserts some MySQL search results
> in the middle of the page. My web hosting provider's
> MySQL uptime is spotty. I'd like the rest of the page
> to load if any of the calls to the database fails.
>
> My first line of PHP code (embedded in HTML) has:
>
> $db = mysql_connect("x","y","z") or
> die("saysomethinghere");
>
> If I have a connection problem, it does print the
> "die" message and the connection error, but it also
> stops the page right there: no more HTML is displayed.
>
> I know about suppressing the error message with "@"
> but this wouldn't seem to help this problem.
>
> Do I need something to exit the embedded PHP and
> continue on with the following HTML if $db ==
> "" ?
>
> Thanks.
>
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>