sandstorm140 Posted March 2, 2009 Share Posted March 2, 2009 I'd like to be able to sort an array by one of the 3 values (username, joindate, or last_login) before it gets echod off. using ksort($value[2]); or something that would work. How can I go about doing this? while ($row[67] = mysql_fetch_assoc($result[67])) { $rowRe[] = array(1=>$row[67]['username'], $row[67]['joindate'], $row[67]['last_login']); } foreach ($rowRe as $value) { echo(' <tr align="left" class="accountinfo"> <td align="center">' . $iii++ . '</td> <td>' . $value[1] . '</td> <td align="center">' . substr($value[2], 0, -9) . '</td> <td align="left" colspan="7">' . substr($value[3], 0, -9) . '</td> </tr>'); } Quote Link to comment https://forums.phpfreaks.com/topic/147552-array-sorting/ Share on other sites More sharing options...
premiso Posted March 2, 2009 Share Posted March 2, 2009 Why not just pull the data out of the query how you want it sorted using ORDER BY? Quote Link to comment https://forums.phpfreaks.com/topic/147552-array-sorting/#findComment-774699 Share on other sites More sharing options...
sandstorm140 Posted March 2, 2009 Author Share Posted March 2, 2009 Why not just pull the data out of the query how you want it sorted using ORDER BY? Because I pull data from multiple tables and databases. Quote Link to comment https://forums.phpfreaks.com/topic/147552-array-sorting/#findComment-774724 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.