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($select Sql);
foreach($select s as $select) {
$content = $select[artist_name].",";
}
Header("Content-Disposition: attachment; filename=export .csv");
print $content;
?>
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($select Sql);
foreach($select s as $select) {
$content = $select[artist_name].",";
}
Header("Content-Disposition: attachment; filename=export .csv");
print $content;
?>
Comment