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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -