php - Query to generate Excel Report Userwise -
i making report quiz application in codeigniter. there 3 tables tbl_users,tbl_answers , tbl_qbank.
tbl_users
t_id | t_name --------------
tbl_qbank
qid | ques | ans_1 | ans_2 | ans_3 | ans_4 | correctans ----------------------------------------------------------------
tbl_answers
ans_id | user_id | q_id | ans_attempted ---------------------------------------------
i want create report displays user information, correct answers , answer attempted him. using phpexcel
i have gotten of things done, need correct query not able figure out. getting answers tbl_answers, showing each row 1 one single user.
i can answers users dont know how them in single row.
i have tried following query
query -> returns answers user information single user
$this->db->select('*'); $this->db->from('tbl_users,tbl_qbank'); $this->db->where('tbl_users.t_id',$uid); $this->db->where('tbl_qbank.qid=tbl_answers.q_id'); $this->db->join('tbl_answers','tbl_users.t_id = tbl_answers.user_id','left'); $query = $this->db->get(); if($query->num_rows()>0){ $results=$query->result_array(); } return $results;
what want show single row user name,questions skipped , questions answered candidates.
Comments
Post a Comment