|
Posted by J.O. Aho on 02/14/06 02:24
Ninja_Monkey wrote:
> hi im trying to write myself a simple database management system. and I have
> noticed that whenever i use a connect command like this:
> $connection = mysqli_connect($_POST['host'], $_POST['user'],
> $_POST['pass']);
I think you should test the variables first to see that you have at least host
and user.
/* we prevent error message to be typed out with the @ */
if($connection = @mysqli_connect($_POST['host'], $_POST['user'],$_POST['pass'])) {
/* connection went okey */
} else {
/* connection failed */
}
> if all three parts are supplied it goes ok and returns an Object which i can
> check after with is_object($connection).
> However if there is the $_POST['pass'] empty and it is required. the error
> it generates automaticly prints the error where the mysqli_connect() was
> called even if i add 'or die()' at the end.
die() don't stop error message output, it just kills the script.
//Aho
Navigation:
[Reply to this message]
|