I’m using odbc_exec to execute sql. It returns the results fine, but I would like to get an array of the sql field names. I have them in the SQL, obviously, but I need a programmatic way to quickly return them from a query
$sql = "SELECT mv_value, mv_entered_by, mv_student_id, mc_module_id, mc_type
FROM MarkbookValue t1
RIGHT JOIN MarkbookColumn t2 ON t1.mv_column_id = t2.mc_id
WHERE DateDiff(minute, mc_date_entered, '" . $date . "') = 0
AND mc_entered_by = '" . $name . "' ";
Running it through:
$result = odbc_exec(CONN, $sql);
I’d like to get an array listing:
mv_value, mv_entered_by, mv_student_id, mc_module_id, mc_type
so I can then output a CSV with headings
This seems like a hack, is there a more elegant solution?