i'm making a to-do list. Every item in this list is nicely put into a table row and sorted by deadline. But i would like to be able for users to order the items by all the fields in my table. As you can see from my code, there are three categories: opdrachtgever, opdrachtnaam and deadline. It would be grand if users could sort this table by clicking on the column heads: opdrachtgever, opdrachtnaam, deadline.
here is my code:
<?php
$sql = "SELECT `ID`, `opdrachtgever` , `opdrachtnaam` , `deadline` FROM `opdracht` ORDER BY 'deadline' ASC";
$result = mysql_query($sql);
echo "<table><tr><td><strong>opdrachtgever</strong></td>
<td><strong>opdrachtnaam</strong></td>
<td><strong>deadline</strong></td>
</tr>";
while ($rij = mysql_fetch_array($result)) {
$id = $rij['ID'];
echo "<tr><td>" . $rij['opdrachtgever'] . "</td>";
echo "<td>" . $rij['opdrachtnaam'] . "</td>";
echo "<td>" . $rij['deadline'] . "</td></tr></table>";
}
?>
Edited by Mr. Matt, 29 November 2006 - 03:14 PM.
