Hi,
In case you haven't already found the answer - this is how I normal do it:
/* Create the csv */
$fp = fopen("php://temp/maxmemory:8396800", 'w+');
/* Add the column headers */
fputcsv($fp, array_keys($rows[0]));
/* Add the rows */
foreach($rows as $rows) {
fputcsv($fp, $row);
}
/* Get the csv as a string */
rewind($fp);
$csv = stream_get_contents($fp);
I guess a similar thing could be done but in reverse. fwrite the
contents, rewind the pointer and read with fgetcsv
- Mike
On 10/12/2008 16:02, Jochen Daum wrote:
> Hi,
>
> I'm writing some data from a database to php://memory to then read it
> with a generic function that reads from a file name. Is this possible?
> I'm assuming that php://memory is available during the duration of the
> request?
>
> Thanks for any pointers on how this works in detail?
>
> Jochen
>
> >
--
Mike Cochrane
Web Team Leader
gardyneHOLT - design partners
18 Beresford Square Newton
PO Box 3340 Auckland New Zealand
p +64 9 300 3155 f +64 9 302 3349 m 021 545 565
skype gardyneholt_mikec
www.gardyneholt.co.nz
DISCLAIMER: This electronic message, together with any attachments, was
created solely for the use of the intended recipient(s), and may be
confidential. Views expressed may be those of the individual sender and are not
necessarily endorsed by gardyneHOLT. If you are not the intended recipient,
please advise us by return e-mail that you have received the message in error
and then delete it. Do not copy, disclose or use the contents in any way.
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---