Re: MySQL Connectivity test

From: Date: Thu, 20 Sep 2001 17:04:23 +0000
Subject: Re: MySQL Connectivity test
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-68019@lists.php.net to get a copy of this message
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 ----- Original Message, by David Robley ----- > > Trying to connect is usually a good indicator :-) > > mysql_connect returns a positive link identifier on success or an error > message on failure. That should do what you want. >

« previous php.general (#68019) next »