Exporting current query results to CSV |
[eluser]eokorie[/eluser]
Hi, Is there a way I can export current query results to CSV? I have look through the forums and in most examples, you either have to export the entire table. In my current scenario, I have filtered my data to display a particular set of results and its the filtered output that I want to export as CSV. Anyone have an idea on achieving this? Thanks eokorie
[eluser]NeoArc[/eluser]
Try $this->load->dbutil(); $query = $this->db->query("SELECT * FROM mytable"); echo $this->dbutil->csv_from_result($query); http://ellislab.com/codeigniter/user-gui...ities.html
[eluser]eokorie[/eluser]
Hi NeoArc, That just allows you to export the entire contents of a table to a csv. However the data is not filtered! Thanks again however.
[eluser]NeoArc[/eluser]
You should learn some MySQL $query = $this->db->query(“SELECT id, name, date, telephone FROM users WHERE creation_date < '2010-11-10' AND status=1 ORDER BY id DESC LIMIT 20”); |
Welcome Guest, Not a member yet? Register Sign In |