I know this has been answered, but I cannot find exactly what I need, and am unsure of how to proceed after checking the manual.
I have the below script running to pull members out of a database. It has an ORDER BY set to first sort by joining date, and then by name.
WHAT I am wanting to do - is make the header of each column clickable (or at least have it where I can click on NAME, CHAPTER, and JOIN DATE) and have it sort by that column.
I have never done this before...so any help is appreciated.
Thanks much.
<?php
$db = mysql_connect("xxxxx", "xxxxx","xxxxx");
mysql_select_db("ssbforum",$db);
$result = mysql_query("SELECT * FROM members, Users WHERE (members.mem_name = Users.U_Username AND mem_active like 'Yes') ORDER BY mem_joined, mem_name",$db);
$number = MYSQL_NUMROWS($result);
$i = 0;
IF ($number == 0) :
PRINT "<CENTER><P>There is nobody that matched the search</CENTER>";
ELSEIF ($number > 0) :
PRINT "<P>";
ENDIF;
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=0 width=100% cellpadding=2>
<td colspan=6><center>There are $number active members.</center></td></tr>
<tr class=content-title><td>Name</td><td>Email</td><td>Chapter</td><td><td>Joined</td></tr>\n";
do {
$time = date("m/d/Y", $myrow["mem_joined"]);
printf("<tr class=content-text><td nowrap><a href=profile.php?Cat=&User=%s>%s</a></td><td
nowrap><font size=1><a href=mailto:%s>%s</a></font></td><td nowrap>%s</td><td
nowrap>%s</td></tr>\n", $myrow["mem_name"], $myrow["mem_name"], $myrow["email"], $myrow["email"], $myrow["mem_game"], $time);
}
while ($myrow = mysql_fetch_array($result));
echo "</td></tr></table>\n";
}
else { echo "No active members, WTF??";
}
}
?>