On Fri, 21 Sep 2001 02:34, Jason Bell wrote:
> Thanks lance and David for the reply. :)
>
> Yes, I suspected as much, *BUT* let me explain what I am trying to do:
>
> I have a script I am writing that uses a MySQL backend. I'm including
> an initial configuration interface via the webbrowser. During initial
> configuration, the user provides parameters for dbhost, dbname, dbpass
> etc etc...
>
> If I simply try and connect, and it fails, I don't want my script to
> error out, or even display an error... I just want it to move along and
> let me deal with informing the user that his database configuration
> does not work correctly.
>
> now, to do this, could I do something as simple as:
>
> $conntest = @mysql_connect($dbhost,$dbuser,$dbpass);
> if ($conntest == "FALSE") {
> // Do my "Oops didn't work stuff here"
> } else {
> // Continue with whatever it was I was doing.
> }
>
> would that work as I expect it to?
>
> thanks!
>
> Jason
>
Here is what I use, called as an include file:
<?php
if(!mysql_connect("localhost", "user")):
/* Return a message to the client and send mail to the administrator */
//Send mail, do page to client saying its broke
exit; //Drop out and don't continue main script
endif; //All ok continue with script
?>
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Don't ask me. The cats are in charge around here.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]