PHP Code:
<?php
/**
* Encode each value of an array for HTML display
* @param array $array
* @return array
*/
function encode_array($array) {
foreach($array as &$el) {
$el = htmlspecialchars($el, ENT_QUOTES);
}
return $array;
}
mysql_select_db($database_KBC, $KBC);
$query_rsTasks = "SELECT tblAuthors.AuthorName, tblTasks.ActionDate, tblClients.ClientName, tblTasks.TimeLength, tblTasks.TaskName FROM tblAuthors INNER JOIN tblTasks ON (tblAuthors.ID = tblTasks.NowResponsible) INNER JOIN tblClients ON (tblTasks.ClientID = tblClients.ID) WHERE (tblTasks.ActionDate BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 10 DAY)) ORDER BY tblAuthors.AuthorName, tblTasks.ActionDate, tblClients.ClientName";
$rsTasks = mysql_query($query_rsTasks, $KBC) or die(mysql_error());
$tasks = "<table>
<thead>
<th>Author Name</th>
<th>Action Date</th>
<th>Client Name</th>
<th>etc....</th>
</thead>
<tbody>";
while($r = mysql_fetch_assoc($rsTasks)) {
$r = encode_array($r);
$tasks.= "<tr>
<td>$r[AuthorName]</td>
<td>$r[ActionDate]</td>
<td>$r[ClientName]</td>
<td>etc....</td>
</tr>\n";
}
$tasks.= "</tbody></table>";
//echo $tasks where you want the table to appear in your document
?>
I've demonstrated with only the first few fields. Add all of yours to the table definition, and the while loop.
Bookmarks