During the new user registration process, I try to find out if the username or email address of the user is in db. To do this, I want to find the number of rows in which the identifier (email address or username) matches the records in the database. If I haven't messed up, the only possible return values are 0 or 1. My function is lower, but I need help to complete it.
function checkUserExists($userIdentifier, $tableColName){
$dbConnection=$this->dbInstance->createConnexion();
$query=$dbConnection->prepare("SELECT count(*) FROM users WHERE ".$tableColName."= :userIdentifier");
$query->bindParam(":userIdentifier", $userIdentifier);
$result=$query->execute();
if( ????? >0){
$return false;
} else return true;
}
Stupid from me, I'm not sure how to get this account number. I suppose this is a variation $query->fetch(), but will it be an array on the right?
source
share