Below is the code I have used to output a table (with headers). This is working fine (obviously I have removed the call to the database as this isn't necessary to show)
I was hoping somebody could help me, I want this to be able to be ordered by any of the headers and with a simple method of doing so (ideally clicking on the header, but don't know if this is possible or by a dropdown menu on the same page)
I'm relatively new to php (having come from mainly ASP & ASP.NET background).
Please ignore my sloppy code but it worked for what I needed it for first day!
Thanks for any help you can give me!
PHP Code:
$result = mysql_query("SELECT * from student");
//Table starting tag and header cells
echo "<table border='1'><tr><th>ID</th><th>Name</th><th>Surname</th><th>Gender</th><th>Date Of Birth</th><th>Telephone</th><th>Request</th><th>Agent</th><th>Host Family ID</th><th>Airport Name</th><th>Airport Arrival Date</th><th>Airport Arrival Time</th><th>Added Details</th></tr>";
while($row = mysql_fetch_array($result))
{
//Display the results in different cells
echo "<tr><td>" . $row['sid'] . "</td><td>" . $row['sname'] . "</td><td>" . $row['ssurname'] . "</td><td>" . $row['sgender'] . "</td><td>" . $row['sdob'] . "</td><td>" . $row['stelephone'] . "</td><td>" . $row['srequest'] . "</td><td>" . $row['sagent'] . "</td><td>" . $row['shostfamilyid'] . "</td><td>" . $row['safairport'] . "</td><td>" . $row['safdate'] . "</td><td>" . $row['saftime'] . "</td><td>" . $row['details'] . "</td></tr>";
}
//Table closing tag
echo "</table>";
Bookmarks