I am getting fatal error any one can help me what is wrong with code.? please help.
public function index(){
$t_name = $this->input->post('t_name');
$row_id = $this->input->post('change_id');
if($t_name == ''){
$t_name = 'table1';
}
if($row_id == '')
{
$row_id = 1;
//Setup a database connection returning a single row value
$this->db->select("*");
$this->db->where("Q_Id", $row_id);
$query = $this->db->get('table1',1,0);
if($query->num_rows() > 0) {
$variable = $query->row("Q_Id");
$qu['res'] = $variable;
} else {
}
}
$this->load->view('admin/question_paper_alter' , $qu);
}
view code. I want to print my row in this table field. any one can help me.
<?php foreach($res->result_array() as $row):?>
<tr>
<td><?php echo $row['rrid']?></td>
<td><?php echo $row['name']?></td>
</tr>
<?php endforeach; ?>
$res? or do you mean$qu['res']->result_array()?$qu['res']I am new to codeiniter so help me.$qu['res'] = $query;. I may be wrong (never worked with codeigniter)