我正在创建一个测验应用程序,所以概念是当测验提交并成功评分时,它将移至我已成功完成的第一个选项卡中,但问题是第二个选项卡,即我的测验名称已回答仍然可见,如何将其删除或在回答考试后使其消失。
到目前为止,我已经使用它来删除,但问题是在我回答活动后,只有第一个索引从第二个选项卡中删除。
第一个选项卡 - 这是考试的结果
<?php foreach($results as $result): ?>
<?php
$res = $result['activity']; ?>
<h4><?php echo $result['activity']; ?></h4>
<?php endforeach; ?>
这是第二个选项卡,显示所有未回答的考试
<?php foreach($posts as $post): ?>
<?php
$pos = $post['activity']; ?>
<?php if($res != $post): ?>
//So by comparing it if it is compared then the name must be removed
<a href="<?php echo base_url() ?>activity/start/<?php echo $post['id']; ?>/<?php echo $id; ?>">
<?php echo $post['activity']; ?>
</a>
<?php endif; ?>
<?php endforeach; ?>
?>
查看所有已发布考试的模型
public function class_posts($id){
$this->db->select('*');
$this->db->from('posts');
$this->db->where('posts.teacher_id', $id);
$query = $this->db->get();
return $result = $query->result_array();
}
考试结果模型以及考试后查看。
public function class_groups($id){
$this->db->select('*');
$this->db->from('posts');
$this->db->join('results', 'results.post_id = posts.id');
$this->db->where('class_id', $id);
$this->db->where('student_id', $this->session->userdata('user_id'));
$this->db->group_by('posts.activity');
$query = $this->db->get();
return $result = $query->result_array();
}
var_dump($post)
湖上湖