php - free_result() with MY_Model -


i have dunction inside my_model i'm trying create, returns either single record or records. i'd when result(s) free memory free_result(), if put in line return result, got nothing. suggestions please?

public function get($id = null, $single = false){          if ($id != null) {              $filter = $this->_primary_filter; // filter id             $id = $filter($id); // e.g. intval($id)              $this->db->where($this->_primary_key, $id);              $method = 'row'; // single record         } elseif ($single === true) {             $method = 'row'; // single record         } else {             $method = 'result'; // records         }         return $this->db->get($this->_table_name)->$method();     } 

you can't free memory results before use results in controller. possible results returned not value pointer/reference results in same place in memory time till page rendered.

using free_result() destroy results before used in controller.

btw: possible results send view pointer/reference can happened page without results if destroy results in controller before page rendered.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -