Reputation: 65
Controller:
$this->data['students'] = $this->student_m->get_order_by_student_sattendance($id);
Model:
function get_order_by_student_sattendance($val) {
$this->db->select()->from(student)->where('FIND_IN_SET($val, classesID)');
$query = $this->db->get();
return $query->result();
}
Hello, i just pass a variable $id to model as $val. But the result is Unknown column '$val' in 'where clause'
SELECT * FROM student
WHERE FIND_IN_SET($val, classesID). I think passing parameter is incorrect. Kindly suggest me the right code.
Thanks in advance
Upvotes: 0
Views: 546
Reputation: 1
try this..change $id to $val
$this->data['students'] = $this->student_m->get_order_by_student_sattendance($val);
Upvotes: -1
Reputation: 339
if your are using single quote ('), you must use concatenation
->where('FIND_IN_SET(' . $val . ', classesID)');
OR use double qoute (")
->where("FIND_IN_SET($val, classesID)");
Upvotes: 4