PDO / PHP计数查询

时间:2019-03-18 18:14:51

标签: php pdo count

此代码无法正常工作,但我认为一切都正确。 我需要计算一下,如果有0行会踢用户。

<?php

require 'config.php';
$email = $_POST['email'];
$codice = $_POST['codice'];
$password = $_POST['password'];

$stmt = $connect->prepare('SELECT count(*) AS conto FROM primoaccesso WHERE 
    email = :email AND codice = :codice AND password = :password');
$stmt->execute(array(
                   ':email' => $email,
                   ':codice' => $codice,
                   ':password' => $password
                   ));
$data = $stmt->fetch(PDO::FETCH_ASSOC);
if($data['conto'] == 0){
    header('Location: /primoaccesso.php');
}

?>

0 个答案:

没有答案