我收到错误说 $id1 和 $id2 未定义。我没有正确访问它们吗?如果不是,我该如何正确访问它们?
$query = $this->db->query("SELECT * FROM churchMembers");
$row = $query->row();
if ($query->num_rows() != 0) {
if ($postingUserId == $row->cMuserId) { // check to see what church the posting user is a member of
$id1 = $row->cMchurchId; // if posting user is a member of a church set it to var id1
}
if ($userid == $row->cMuserId) { // check to see what church myuserid is a member of
$id2 = $row->cMchurchId; // if myuserid is a member of a church set it to var2
}
if ($id1 == $id2) { // if posting user and myuserid are a member of the same church process the following
echo json_encode(array('loggedIn' => true, 'isMembershipSame' => true));
}
elseif ($id1 != $id2) { // if posting user and myuserid are not a member of the same user process the following
echo json_encode(array('loggedIn' => true, 'isMembershipSame' => false));
}
}