Jump to content


Photo

sorting and resorting


  • Please log in to reply
1 reply to this topic

#1 greybeard

greybeard
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 01 November 2005 - 01:52 AM

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

#2 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 01 November 2005 - 04:17 AM

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.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users