I have a situation where I am looping through a result set from the DB in MYSQL:
$result = mysql_query("SELECT * FROM orders ORDER BY repID") or die('Query failed!');
while(false !== ($row = mysql_fetch_assoc($result))) {
if(!$flag) {
// display field/column names as first row
fputcsv($out, array_keys($row), ',', '"');
$flag = true;
}
array_walk($row, 'cleanData');
fputcsv($out, array_values($row), ',', '"');
}
So this prints out the array keys as column headers for the first row.
In some rows I have ID's that come directly out of the table, so I need to replace the values in specific rows with a function to use the given ID as a search parameter in a DB query.
I just cant seem to find a way to change the array value of a specific column within the loop... any ideas?