Hello, I have been working with some arrays and I am having issues trying to sort and display all the data in the array. I am pretty sure I am adding the correct info to the array as var_dump seems to have all the info inside it.
Here is how I push the data to the array:
$person = array('user' => $row['USERS'], 'total' => $row_cntw, 'goal' => $rgoal, 'dailycount' => $dailycount); array_push($sortusers, $person);
I would like to sort it by the “total” value then display all the data something like this.
User : anderson - Total : 259 - Goal : - dailycount :
Here is the var_dump($sortusers);
array(18) { [0]=> array(4) { ["user"]=> string(8) "anderson" ["total"]=> int(259) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [1]=> array(4) { ["user"]=> string(8) "anibal17" ["total"]=> int(17130) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [2]=> array(4) { ["user"]=> string(4) "BROC" ["total"]=> int(59) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [3]=> array(4) { ["user"]=> string(9) "CAITLINMC" ["total"]=> int(10413) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [4]=> array(4) { ["user"]=> string(7) "DGil915" ["total"]=> int(74) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [5]=> array(4) { ["user"]=> string(7) "dominic" ["total"]=> int(82) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [6]=> array(4) { ["user"]=> string(4) "gman" ["total"]=> int(306) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [7]=> array(4) { ["user"]=> string(11) "guevara7941" ["total"]=> int(6528) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [8]=> array(4) { ["user"]=> string(11) "johnnydingo" ["total"]=> int(72) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [9]=> array(4) { ["user"]=> string(8) "manchaca" ["total"]=> int(128) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [10]=> array(4) { ["user"]=> string(2) "MJ" ["total"]=> int(557) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [11]=> array(4) { ["user"]=> string(3) "Neo" ["total"]=> int(24) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [12]=> array(4) { ["user"]=> string(12) "onlineorders" ["total"]=> int(58) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [13]=> array(4) { ["user"]=> string(8) "pawnshop" ["total"]=> int(64) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [14]=> array(4) { ["user"]=> string(4) "room" ["total"]=> int(8) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [15]=> array(4) { ["user"]=> string(9) "roundrock" ["total"]=> int(1) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [16]=> array(4) { ["user"]=> string(5) "Zahir" ["total"]=> int(308) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } [17]=> array(4) { ["user"]=> string(11) "Zahirmadani" ["total"]=> int(18) ["goal"]=> string(2) "60" ["dailycount"]=> int(74) } }
Hope everything is clear.
Thanks!