[KLUG Members] Best way to use temp files in PHP

bill members@kalamazoolinux.org
Mon, 09 Sep 2002 10:22:25 -0400


Have you considered temporary tables in your db?  Preserves all your structure with
fields as columns.

It leaves you with much more flexibility than a flat file on the disk because you
have all your query tools like sort by field [column], etc.  Plus it doesn't vanish
into the ether when a process dies.

adam@morrison-ind.com wrote:

> I have a PHP object, columnar report.  This lets me define columns (width, data
> types, justification, etc...) and then go about pumping to full of rows.  Once
> it is full I can do things like sort by a column, and then finally dump it to
> some kind of output.  This works great.
>
> But...
>
> internall it holds all this information in an array.  So I've got a report with
> 15 columns of various types, and a heck of alot of rows.  At about ~40,000 rows
> I hear "Ahhhhhhhhhhhhhhhhhhhhhhhhhhhh!" as a temporal rift occurs to some hell
> dimension and my PHP process topples into it.  So I'm thinking I just can't have
> arrays that big.
>
> So maybe the answer is I should write all this to a temporary file.  But I'd
> like to still maintain the `intelligence' of an array with its self described
> structure and sort-ability.  If anyone has any tips on the best way to go about
> this I'm all ears (actually, they are still ringing from PHP's cries of agony).
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
>