In need of help with MySQL & PHP!?

Chris Y

New member
Right here's the low down
I've outputted information from a MySQL table, but now i need to make it so that when the table column headers are clicked, it sorts the data into ascending order...here's my current code;
(Code does connect to database & select table ect ect....)

$result = mysql_query("SELECT * FROM customer");
echo "<table id = 'container2' align = 'center' border='0'>
<tr>
<h2> Customer Details </h2>
<th>Name</th>
<th>Address</th>
<th>Postcode</th>
<th>Telephone</th>
<th>Email</th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . asort($row['name']) . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['postcode'] . "</td>";
echo "<td>" . $row['telephone'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}

echo "</table> <br />";
Sorry just realised the asort($row['name2];

That isn't in my code anymore, i was just testing
 
Back
Top