Node1id 是发送请求的用户,node2id 是接收请求的用户。我如何将下面的代码限制为仅显示对 node2id 的请求。我试着做:
$row->relationType == 'requested' && node2id == $userid
但它似乎不想工作。有任何想法吗?
<?php
$selectedId = $_REQUEST['id'];
$myuserid = $this->session->userdata('userid');
$query1 = $this->db->query("SELECT * FROM friends WHERE node1id = '{$myuserid}' AND node2id = '${selectedId}'");
foreach($query1->result() as $row) {
if ($row->relationType == 'requested') { ?>
<script type="text/javascript">
$(document).ready(function() {
$("#addFriend").replaceWith('<span id="requestAlert"><span class="font1">wants to be your friend </span><input type="submit" id="acceptRequest" value="Accept" style="width: 60px; height: 28px" class="button1" /> <input type="submit" id="denyRequest" value="Deny" style="width: 50px; height: 28px" class="button1" /></span>');
});
</script>
<?php } } ?>