Nosferatum wrote:
> I have a mysql table with all data exposed on a page. On the top of
> the page I would like to have a link sorting table data, following a
> query like ORDER BY first_name DESC and maybe ORDER BY last_name. But
> how do I wrap this event in a link in the top of the output document?
>
> The SQL syntax is easy and must be like this:
> <php
> SELECT * FROM my_big_table ORDER BY first_name DESC;
> ?>
> But... how to manually trig this event with a link?
I would use a form.
<form method="post" action="{$_SERVER['REQUEST_URI']}">
<fieldset>
<legend>For information/comments this website.</legend>
Please select the field you wish to sort on:<br>
<select name="field">
<option value="lastName">Last Name</option>
<option value="firstName">First Name</option>
<option value="whatever">whatever</option>
</select>
</fieldset>
</form>
$field=$POST['field'];
SELECT * FROM my_big_table ORDER BY $field DESC;
--
TK
http://wejuggle2.com/
Still Having a Ball