我使用这种语法而不是 count (*) 因为它应该更快,但我不知道如何获取结果输出
$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}
但它似乎没有返回正确的东西,知道吗?