Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 3.1.7 unbuffered_row() returning NULL but row() works
#7

(04-24-2018, 12:40 PM)pbarney Wrote:
(04-24-2018, 07:10 AM)Narf Wrote:
(03-10-2018, 11:22 AM)pbarney Wrote: Is there a way to display the results of a query and simultaneously save the CSV of results without having to run the query twice?

It might be possible (I'm not entirely sure, and if it is, it would depend on the DB driver in use), but the real problem is that there's no reason why you or anyone else should ever need it to be.

Display what you need to display and be done with it. If for some reason, you need to archive something - make cronjobs do it.

Thanks for the reply. The use case is different from what you might expect. A query of many thousands of records that the end user needs to both see and download. I obviously can't store that much data in memory, so I was hoping for a dual solution.

After looking in-depth at the DB driver, it's clear to me that it's just not attainable. It's very much one-or-the-other.

My preferred solution would be to re-run the query when the use clicks the "download csv" button, but they end up clicking it about 95% of the time anyway. As a result, the client prefers a good user interface experience over performance.

Well, that's the exact use case for which you don't need to both display and process into CSV - those happen on 2 separate requests anyway, so why would you need to do both at the same time?
Reply


Messages In This Thread
RE: CodeIgniter 3.1.7 unbuffered_row() returning NULL but row() works - by Narf - 04-25-2018, 06:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB