Jump to content

Archived

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

greybeard

sorting and resorting

Recommended Posts

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)); ?>

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

×

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.