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'];
}
fopen(), in whatever location on disk you like (or have the privileges for) 2) look upfputcsv()3) close the filemysql_database extension in new code this happens it is deprecated and has been for years and is gone for ever in PHP7.0+. If you are just learning PHP, spend your energies learning thePDOormysqlidatabase extensions and prepared statements. Start here