phpcodeigniterquery-builder

Active records on codeigniter page


I want print a table from database on view page with where condition, means I want print table of student where class is seven and fee status is paid.

How we do this?

I tried it but not work:

$students = $this->db->get_where('student' , array('status' => paid,'class_id'=>7))->result_array();

Solution

  • I have used this code to find the answer for you Please see it and try it out

    $query = $this->db->get_where('tasks', array('description' => 7,'status' => 1));
            echo "<pre>";
            print_r($query->result_array());
    

    change your array element as this since paid is a string it must be in quots

    array('description' => "paid",'class_id'=>7)