HTML PHP: IF li element clicked, ORDERBY DESC or ASC : <p>I have a ascending and descending list element within my html. If the user clicks on the ascending li I wish for the products in my SQLi to be shown in ascending order, if descending, descending order. </p>

<p>This is what I have come up with, but does not work.</p>

<pre><code>&lt;ul align ="center"&gt;
              &lt;li name="asc" onclick="AscendingProds()"&gt;&lt;a&gt;Ascending to Descending&lt;/a&gt;&lt;/li&gt;
              &lt;li name="desc" onclick="DescendingProds()"&gt;&lt;a&gt;Descending to Ascending&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;


    &lt;?php

    AscendingProds(){
        $results = $mysqli-&gt;query("SELECT prds ORDER BY price ASC");
}
    DescendingProds(){
        $results = $mysqli-&gt;query("SELECT prds ORDER BY price DESC");
}
</code></pre>
