Mysql
 sql >> Database >  >> RDS >> Mysql

ordina per XXX ordina per ASC o DESC , ordinamento dinamico, mysql...

<?php

    $order = ($_GET['order'] == 'asc') ? 'asc' : 'desc';

    $sql = "SELECT .... FROM ... WHERE ... ORDER BY TITLE $order";
    mysql_query($sql) or die(mysql_error());
    ...

     $new_order = ($order == 'asc' ) ? 'desc' : 'asc';
?>

<table>
<thead><tr>
    <th><a href="scriptname.php?order=<?php echo $new_order ?>">TITLE</a></th>
    <th>Total</th>
</tr></thead>
etc....