I am trying to create a csv file out of this and save it to a file in my directory. How would you accomplish this? Thanks.
$sql = mysql_query("SELECT code, count FROM products WHERE active = '1' ORDER BY code Asc") or die(mysql_error());
while ($row = mysql_fetch_array($sql)) {
$code = $row['code'];
$quantity = $row['quantity'];
}