greybeard Posted November 1, 2005 Share Posted November 1, 2005 I need to be able to click on the table header an sort ascend or desend, This is the way it works now, (I left off some of the table html) any ideas? $query_stuff_in_db = "SELECT * FROM new_stuff ORDER BY some_number1 ASC;"; <TH><b>Column 1</font></b></TH> <TH><b>Column 2</font></b></TH> <TH><b>Column 3</font></b></TH> </TR> <?php do { ?> <td> <?php echo $row_stuff_in_db['some_number1'];></td> <td><?php echo $row_stuff_in_db['some_number2'];></td> <td><?php echo $row_stuff_in_db['some_number3'];></td> </tr> <?php } while ($row_stuff_in_db = mysql_fetch_assoc($stuff_in_db)); ?> Quote Link to comment https://forums.phpfreaks.com/topic/2774-sorting-and-resorting/ Share on other sites More sharing options...
ryanlwh Posted November 1, 2005 Share Posted November 1, 2005 use some get variables like sort=column1&orderby=asc in the query you replace those two parts with the variables. of course you'd need to secure the page so they cannot inject something to mess up the query. Quote Link to comment https://forums.phpfreaks.com/topic/2774-sorting-and-resorting/#findComment-9284 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.