MYSLI help

[php]
if($ingelogd) {

header("location:?p=home");

} else {
global $db;
echo 'Niet ingelod verder:
';
//niet ingelogd, case 1, via een formulier tot hier, case 2 zelf gedaan

//case 1, we gaan ervanuit dat ze allebij zijn ingevuld

if(isset($_POST) && !empty($_POST['myusername']) && !empty($_POST['mypassword'])) {
	echo 'Alle velden ingevuld, verder: <br>';
	$myu = SAFE($_POST['myusername']); //escape, trim, md5 if TRUE
	$myp = SAFE($_POST['mypassword'], TRUE); //escape, trim, md5 if TRUE
	$statement = $db->prepare("SELECT * FROM USER WHERE EMAIL = ? AND PASSWORD = ?");
	$statement->bind_param("ss", $myu, $myp);
	$statement->execute();
		
	echo 'we hebben dit aantal resultaten' . $statement->num_rows . '<br>'; 
	if($statement->num_rows == 1) {

		echo 'succes <br>';
	
	} else {
		echo 'fail <br>';
		
		$statement = $db->prepare("SELECT * FROM USER WHERE EMAIL = ?");
		$statement->bind_param('s', $myu);
		$statement->execute();

		if($statement->num_rows == 1) {
			notibox('WRONGPASSWORD');
			$ub = $myu;
		}
		else {
			notibox('INCORRECTFIELDS'); //functie voor een kadertje
			echo '4:'.$statement->num_rows.'<br>';
		}
		
		include_once('PAGE/login.php');
	
	}
	
} else {

	notibox('FORGOTFIELD');
	include_once('PAGE/login.php');
	
}

}

[/php]

Db connection is oke, functions works, …

If i put in an mailadress and password still not compair, only good email still not oke,

output:

Niet ingelod verder: Alle velden ingevuld, verder: we hebben dit aantal resultaten0 fail Fatal error: Call to a member function bind_param() on a non-object in /customers/9/a/0/pandelhofs.be/httpd.www/PAGE/checklogin.php on line 35

Do you have error reporting enabled? If prepare is returning false it is probably an SQL syntax error (which could be bad table or field names)

I did no error, nothing is that the right setup ?

Sponsor our Newsletter | Privacy Policy | Terms of Service