I’m using this syntax instead of count (*) because it’s supposed to be faster but I dont know how to fetch the resulting output
$alreadyMember = $dataBase->prepare('SELECT EXISTS ( SELECT 1
FROM TheCommunityReachLinkingTable
WHERE communityKey = :communityKey
AND userID = :userID)');
$alreadyMember->bindParam(':communityKey', $_POST['communityKey'], PDO::PARAM_STR);
$alreadyMember->bindParam(':userID', $_POST['userID'], PDO::PARAM_INT);
$alreadyMember->execute();
if($alreadyMember->fetch()) {do code here}
But it doesn’t seems to return something correct, any idea?
The use of
EXISTSseems wrong here. Just execute this query instead: