Fetch posts from db-table, do math and THEN sort <- how?
<p>For fetching some db-posts (int) and then multiplying with user input-values I use php. </p>

<pre><code>$result = mysql_query("SELECT * FROM table")or die("Error" . mysql_error());
    while($row = mysql_fetch_array($result)){
        $value1=$row['value1'];
        $value2=$row['value2'];
        $value3=$row['value3'];
        $product1=$value1*$userinput1;
        $product2=$value2*$userinput2;
        $product3=$value3*$userinput3;
     }
</code></pre>

<p>[Now show results sorted by e.g. product1 ASC]</p>

<p>HOW?</p>

<p>Also how to make it possile to let the user change to e.g. sort by product2?</p>

<p>How can I then show the resluts, sorted by the sum of the user in put and one value from the row. And also give the user the possibility to change which value and user-input sum to sort by.</p>
