我似乎无法在下面的 php 代码中处理 elseif。我的数据库设置如下所示:
<?php // the following php is the bootstrapper for the friendship connector
$selectedId = $_REQUEST['id'];
$myuserid = $this->session->userdata('userid');
$friendshipQuery = $this->db->query("SELECT * FROM friends");
$row = $friendshipQuery->row();
foreach ($friendshipQuery->result() as $row) {
if ($myuserid == $selectedId) { ?>
<script type="text/javascript">
$(document).ready(function() {
$("#addFriend").hide();
});
</script>
<?php } elseif ($row->relationType == 'requested') { ?>
<script type="text/javascript">
$(document).ready(function() {
alert("hello");
$("#addFriend").replaceWith(<input type="submit" value="Accept Friend" style="width: 95px; height: 28px" class="button1" />);
});
</script>
<?php } } ?>