Posted by mpar612 on 03/07/07 23:41
Hello,
I'm sort of new to PHP. I am using the following code to retrieve a
column from a database and to put all of the results into a .csv
file. This allows creates a .csv file, but only lists the first
result from the database. It is not returning all of the rows. I
know the issue is somewhere in my "foreach" but I'm not sure where.
Any help would be great. Thanks!
<?php
$selectSql = "SELECT artist_name FROM lounge_products";
$selects = $db->getAll($selectSql);
foreach($selects as $select) {
$content = $select[artist_name].",";
}
Header("Content-Disposition: attachment; filename=export.csv");
print $content;
?>
[Back to original message]
|