$statement = $conn->prepare("your query");
$statement->execute($dataArray);
$row = $statement->fetch(PDO::FETCH_ASSOC); //also you dont need a LIMIT 1 at this place because fetch fetches only one row
if(!$row){
header("location: ../index.php");
}
echo $row['name'];
@ketting00 but this does not make any sense at all, you have LIMIT 1 in your query and SpacePhoenix is using fetchAll method Pepster solution is closer to your problem
the difference is that @SpacePhoenix wants to count the number of results, so he has to use fetchAll() even if there is only a single result. but counting result rows ain’t necessary at all as @BlackScorp demonstrates.
@BlackScorp yes, Exceptions must be explicitly enabled. @BlackScorp the LIMIT 1 is not necessary, since emailand password must be a unique (composite) key