Php Pdo execute未返回结果

Php Pdo execute未返回结果,php,mysql,login,Php,Mysql,Login,我正在尝试一个简单的代码,然后使用密码\u hash()加密密码进行添加 html <form action="includes/process_login.php" method="post" name="login_form"> Email: <input type="text" name="email" id="email" /> Password: <input type="password" na

我正在尝试一个简单的代码,然后使用密码\u hash()加密密码进行添加

html

<form action="includes/process_login.php" method="post" name="login_form">                      
    Email: <input type="text" name="email" id="email" />
    Password: <input type="password" name="password" id="password"/>
    <input type="submit" value="Connection" /> 
</form>
使用
$data
的一个
echo
,它总是返回
1
。 但是当我在mysql中运行SQL行时,它返回了一个好的答案


为什么?

使用execute()发出请求时,返回值只是一个错误代码。所以基本上,这意味着请求成功完成了。要查找该值,您需要获取该值。
您应该尝试
$count=(int)$req->fetch(PDO::fetch_OBJ)->membre_valide

执行
函数,但不
获取
结果:

$exec = $req->execute();
    //$exec will be "true" if it executes; "false" if it doesn't

$data = $req->fetch(PDO::FETCH_ASSOC);
    //fetch() for one row, fetchAll() to retrieve all rows
$exec = $req->execute();
    //$exec will be "true" if it executes; "false" if it doesn't

$data = $req->fetch(PDO::FETCH_ASSOC);
    //fetch() for one row, fetchAll() to retrieve all rows