CodeIgniter Forums

Full Version: [PENDING] Exporting data to files (which plugins ?)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Morty[/eluser]
Hi there!

I am quite successful in building my first CI application, and since I now have good results coming from my database, I would like to export them to Excel-readable files. There seems to be plugins/libraries to export QUERIES (or query results) directly to CSVs (or XLS) but I want to modify some of my results before sending them to CSV files.

- Is it possible to change query results, like adding columns and entries ?
- Which libraries / plugins are available to export data ?

Thanks in advance,
Morty

El Forum

[eluser]Glen Swinfield[/eluser]
To change a query result you need to change the query. Query result = result of query.

But you can operate on a php array created from a query result, you'll need some array functions though.

El Forum

[eluser]Morty[/eluser]
I can't change the query to display what I actually want because some of my info need to be aggregated.

Example:
idSite | Where | Qty
ALO | C5 | 10
ALO | C6 | 10

I need to save:

idSite | C5 | C6
ALO | 10 | 10

That's of course simplified.