i have researched on didnt come correct answer, trying pass multiple arguments sql query in code igniter without using active records , not working me, see have done below
in model have:
function get_values($id, $age) { $sql='select * tblregister id=? , unit=?'; $query=$this->db->query($sql, array('$id','$age')); return $query->result_array(); } in controller have:
function get_values() { $result=$this->register_model->get_values(32, 23); } this doesnt work me, think error passing arguments query, how format syntax works fine? regards
try variables without quotation marks: array($id, $age)
function get_values($id, $age) { $sql='select * tblregister id=? , unit=?'; $query=$this->db->query($sql, array($id,$age)); return $query->result_array(); }
Comments
Post a Comment