Abhishek Joshi Abhishek Joshi - 2 months ago 31
PHP Question

Call to undefined method CI_DB_mysql_driver::row_array()

Hey i am novice in CI so please forgive! I am trying to join 2 tables in codeigniter and i am getting here these error in my code

Call to undefined method CI_DB_mysql_driver::row_array() in
C:\xampp\htdocs\Hostel\application\models\payfees.php on line 16.

My Code for the method is here like these

public function payu($id,$month){
$where = "where generatebills.student_id='".$id."' and generatebills.month='".$month."'";
$query = $this->db->select('*')
return $query->row_array();


Don't forget the missing ->get() method. Plus, remove the WHERE in the string:

$where = "name='Joe' AND status='boss' OR status='active'";


I'd suggest use an array instead:

public function payu($id,$month)
    // $where = "generatebills.student_id='".$id."' and generatebills.month='".$month."'";
    $where = array(
        'generatebills.student_id' => $id,
        'generatebills.month' => $month,

    $query =  $this->db->select('generatebills.*')
        ->join('student','student.student_id = generatebills.student_id')

    return $query->get()->row_array();
               //  ^