require_once $CFG->root . 'lib/utils.inc.php';
function createHeader($data) {
- $out = '';
+ $out = '<th>Id</th>';
foreach ($data as $head => $value) {
- $out .= '<th>$head</th>';
+ $out .= "<th>$head</th>";
}
return $out;
}
$headers = createHeader($raw[0]);
$r = "<table><tr>$headers</tr>";
+ $i = 1;
foreach ($raw as $obj) {
- $r .= '<tr>';
+ $r .= "<tr><td>$i</td>";
foreach ($obj as $value) {
$r .= "<td>$value</td>";
}