FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Send .csv file to browser
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Send .csv file to browser [message #170050 is a reply to message #170047] Thu, 07 October 2010 12:49 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/7/2010 8:08 AM, Derek Turner wrote:
> On Thu, 07 Oct 2010 10:25:50 +0000, Derek Turner wrote:
>
>> <snip very useful material>
>>
>> Many thanks, Jerry, I'll give it a go and report back.
>
> <?php
> include("/home/cantabi1/admin_connect.php");
> $sql = "SELECT `givenName`, `familyName`, `email`, `mobile`, `landLine`
> FROM `member` WHERE `active` = 1";
> $result = mysql_query($sql, $conn) or die (mysql_error());
> if ($result) {
> $outfile = fopen('php://output', 'w');
> header('Content-Type: text/csv');
> header('Content-disposition: attachment; filename=data.csv');
> while ($row = mysql_fetch_array($result)) {
> fputcsv($outfile, $row);
> }
> fclose($outfile);
> }
> ?>
>
> Produces a csv file just fine BUT each variable is doubled up i.e.
> Derek,Derek,Turner,Turner, etc. can anyone see why?
>

Sorry, as I said - it was a quick post because I'm very busy right now.
But I hope you get the point.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: file access permission?
Next Topic: Process queue without cron jobs
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 09:09:22 GMT 2024

Total time taken to generate the page: 0.05068 seconds