I'm working on web app that require a login page, everything work until I try to convert to PDO and use prepared query here is my code:
$req=$idconnex->prepare("SELECT * FROM `enseignant` WHERE ens_cin=:cin AND ens_pass=:pass");
$req->bindParam(':cin',$_GET["login"]);
$req->bindParam(':pass',$_GET["password"]);
$res=$idconnex->exec($req);
if(!empty($res) AND $res->rowCount==1)
{echo 'SUCCESS';}
else
{echo 'FAIL';}
A warning appearsy:
Warning: PDO::exec() expects parameter 1 to be string, object given in...
and it return FAIL as result even I insert correct param!