RE: [PHP] exporting data

From: Date: Sat, 19 Apr 2003 18:40:52 +0000
Subject: RE: [PHP] exporting data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144491@lists.php.net to get a copy of this message
On 19-Apr-2003 M.E. Suliman wrote: > Hi > > Any idea on how one can export certain columns in a mySQL database to > delimited text files using PHP. > $qry=" SELECT col1,col2,col ... FROM table"; if ($res= mysql_query($qry)) { $fp=fopen('data.csv', 'w'); while ($row = mysql_fetch_row($res)) { fputs($fp, "'" .implode("','", $row) ."'\n"); } fclose($fp); } Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#144491) next »