Jump to content

ordering and changing results on a page?


shadiadiph

Recommended Posts

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

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";   

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.