Hi,
I'm retrieving data from a database where it is being called onto a page in a number of different rows based on what is in the database. What i want to do is organise this data into a sortable table whereby the user will be able to click on the column header and sort by ascending or descending. I would appreciate if anyone could assist with this. Does anyone know any possible way of organising this into a sortable table. Thank you. Here is the code which is calling the data from the database...
<?php
$con = mysql_connect("xxx","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxx", $con);
$result = mysql_query("SELECT * FROM proposal WHERE username = '$username'");
echo "<table cellpadding='0'>
<thead>
<th>Location</th>
<th>Hotel Star</th>
<th>Check-in</th>
<th>Check-out</th>
<th>Budget</th>
<th>Adults</th>
<th>Children</th>
<th>Single Rooms</th>
<th>Double Rooms</th>
<th>Twin Rooms</th>
<th>Family Rooms</th>
<th>Breakfast</th>
<th>Special Requirements</th>
</thead>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['county'] . "</td>";
echo "<td>" . $row['starrating'] . "</td>";
echo "<td>" . $row['checkin'] . "</td>";
echo "<td>" . $row['checkout'] . "</td>";
echo "<td>" . $row['budget'] . "</td>";
echo "<td>" . $row['adults'] . "</td>";
echo "<td>" . $row['children'] . "</td>";
echo "<td>" . $row['singlerooms'] . "</td>";
echo "<td>" . $row['doublerooms'] . "</td>";
echo "<td>" . $row['twinrooms'] . "</td>";
echo "<td>" . $row['familyrooms'] . "</td>";
echo "<td>" . $row['breakfast'] . "</td>";
echo "<td>" . $row['requirments'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>