i have following simple class with static method in php which check if record exist then return the record otherwise return false
  class db{
      public static function isRecord($q,$parameters){  
        $a=self::getinstance()->prepare($q);
        $a->execute($parameters);
        $r=$a->fetch(PDO::FETCH_NUM);
        if($r[0]) return $r[0]; 
        if(!$r[0] || $r[0]==0 ) return false;
     }
  }
usage
  $e=db::isRecord("SELECT itemdesc FROM temptable WHERE invuser=? ",array($invuser));
returns $e as expected.
but if i use with in simple function like this
function canEnterincart(){
    return db::isRecord("SELECT itemdesc FROM temptable WHERE invuser=? ",array($invuser));
}
var_dump(canEnterincart()) always return false even if the record exist. 
Is this something wrong with the code?
 
    