shadiadiph Posted January 19, 2009 Share Posted January 19, 2009 I have a table that is called displayed and the table data is echoed to show the results. I would like tot know how can I make it so that if someone clicks on the heading make the order change order by date asc desc order by name asc desc on second click? <tr><td class="tradehead">SENT</td><td class="tradehead">FIRSTNAME</td><td class="tradehead">LASTNAME</td><td class="tradehead">EMAIL</td></tr> $sql = "SELECT * FROM tblmaildetails order by intMailID DESC LIMIT $offset, $rowsperpage"; $result = mysql_query($sql) or trigger_error("SQL"); $mailcount =$DB_site->num_rows($result);{ while ($row = mysql_fetch_assoc($result)) { $mid = $row["intMailID"]; Link to comment https://forums.phpfreaks.com/topic/141521-ordering-and-changing-results-on-a-page/ Share on other sites More sharing options...
flyhoney Posted January 19, 2009 Share Posted January 19, 2009 http://www.millstream.com.au/view/code/tablekit Link to comment https://forums.phpfreaks.com/topic/141521-ordering-and-changing-results-on-a-page/#findComment-740783 Share on other sites More sharing options...
shadiadiph Posted January 20, 2009 Author Share Posted January 20, 2009 mm thanks I looked at that but i really don't want to be opening a bag of worms with AJAX right now i am just getting used to php. I got mine partially working by using but doesn't arrange asc desc wish i could figure another workaround for it. <? $oid= $_GET["oid"]; if ($oid=="") { $oid="intMailID DESC"; } ?> <table class="trackemails"> <tr> <td class="tradehead">SENT</td><td class="tradehead"><a href="track_emails.php?oid=sort">SORT</a></td><td class="tradehead"><a href="track_emails.php?oid=advisor">ADVISOR</a></td><td class="tradehead"><a href="track_emails.php?oid=client">CLIENT</a></td><td class="tradehead"><a href="track_emails.php?oid=emailclient">EMAIL</a></td><td class="tradehead">READ</td><td class="tradehead">DATE</td><td class="tradehead">WEB</td><td class="tradehead">ACTION</td></tr> then $sql = "SELECT * FROM tblmaildetails order by $oid LIMIT $offset, $rowsperpage"; Link to comment https://forums.phpfreaks.com/topic/141521-ordering-and-changing-results-on-a-page/#findComment-741002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.