Undefined index: count(*) PDO

Wednesday, November 4, 2015

So I'm recreating link generation function from mysql to PDO and I have a problem.



    $sth = $resDB->prepare("SELECT count(*) FROM downloads WHERE downloadkey = '{$strKey}' LIMIT 1");
$arrCheck = $sth->fetchAll();
if($arrCheck['count(*)']){
//key already in use
return createKey();
}else{
//key is OK
return $strKey;
}


Everything goes well until this line: if($arrCheck['count(*)'])



I get the error like this: Undefined index: count(*)



I just don't know how to change that line to PDO. Can you help me ?

0 comments:

Post a Comment