PHP在提交搜索后对查询结果进行排序

How can I order the query results after the search has been done and the items are displayed on the screen? I want the user to be able to rearrange the order of results based on preference of price, data, etc..

$output ='';
    if(isset($_POST['search'])){
        $searchq = $_POST['search'];
        $searchq = preg_replace("#[^0-9a-z]#i","",$searchq);

        $query = mysql_query("SELECT * FROM `db_table` WHERE title LIKE '%$searchq%' OR description LIKE '%$searchq%' ORDER BY `date` ASC");
        $count = mysql_num_rows($query);
        if($count == 0){
            $output = 'No results found';
        }else{
            while($row = mysql_fetch_array($query)){
         //display divs

All help is much appreciated!

After? You can do it in Javascript, manipulating the html.

There are many ways, many libraries. The first I found is that one:

https://datatables.net/

You can do it also without a library, but will be much harder.

You can sent some data by $_GET and then do something like this in query:

$query = mysql_query("SELECT * FROM `db_table` WHERE title LIKE '%$searchq%' OR description LIKE '%$searchq%' ORDER BY `".$_GET['orderby']."` ASC");

Of course You should secure code against SQL injections ;)

If you're using jquery this plugin is very effective and small http://tablesorter.com/docs/#Demo