how I can replace $this variable in this code? I know that it is incorrect to use $this in functions, but I don't know how I may replace that.
function get_dates($id) {
$class = $this->db->query("SELECT * FROM schedule WHERE class_id='".$id."'");
$class = $class->result_array();
return $class;
}
PS. I don't won't to work with mysql with standart php features and I strongly believe that it is possible to solve this problem with CI featues.
If you want to access the CI framework from inside a plain function, you need to get an instance of CI.
function get_dates($id) {
$ci =& get_instance();
$class = $ci->db->query("SELECT * FROM schedule WHERE class_id='".$id."'");
$class = $class->result_array();
return $class;
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments