Hey there,
I am dealing with the fetch() on a non-object and not sure why it is displaying this error, well i know why but not sure why (make sense???) it is this line
$row = $s->fetch();
$query = "SELECT id,farmName,level,salt1,salt2,password FROM users WHERE email = :email";
$email = $clean->text($_POST['email']);
$rawPass = $clean->text(hash('sha256',$_POST['password']));
$values = array('email' => $email);
try {
$lookup = $pdo->prepare($query);
$s = $lookup->execute($values);
} catch (PDOException $e) {
$message .= "There has been an error trying to login in::: {$e->getMessage()}";
$title = "Error!";
}
$row = $s->fetch();
if($row[0] > 0){
if($row['salt1'].$rawPass.$row['salt2'] == $row['password'])
{
$_SESSION['email'] = $row['email'];
$_SESSION['id'] = $row['id'];
$_SESSION['name'] = $row['name'];
$_SESSION['level'] = $row['level'];
$_SESSION['farmname'] = $row['farmname'];
}
$message .= "You have been logged in!";
$title = "Logged in!";
}
else {
$message .= "Password or email was wrong";
$title = "There was an error";
}
$pdo is defined in a config file that i include.