php - Clear SELECT fields in CodeIgniter -
i'm using function set entire sql query. function used other 2 sql , use need.
now, want function execute same query don't need fields previous functions needed. so, want know if there way replace select portion of query after it's set.
pseudocode:
function sql(){ $this->db->select('*'); $this->db->from('table'); } function defaultsql(){ $this->sql(); $this->get(); } function notallfields(){ $this->sql(); // solution i'm looking for. should clear select $this->db->clearselect(); // define different select $this->db->select('field'); $this->get(); }
thanks in advance!
can u try way??
function sql($fields = '*') { $this->db->select($fields); $this->db->from('table'); } function defaultsql() { $this->sql(); // ...... } function notallfields() { $this->sql('field'); // ..... }
Comments
Post a Comment