I have a query that outputs 4 fields from a DB. Each row contains data like so:
$id = 1; $name = John; $items = 2; $price = 4.2; $saleprice = 2.0; $id = 2; $name = James; $items = 1; $price = 1.01; $saleprice = 1.0; $id = 3; $name = andrew; $items = 6; $price = 13; $saleprice = 10;
before I echo out the variables, I want to sort the results by the $price. I do not want to sort the results from the SQL query itself, just in PHP.
I figured I can do something like:
$testdatasort = array($id,$name,$items,$price,$saleprice); sort($testdatasort); var_dump($testdatasort);
But I just can't seem to get it to work right :(