Re: multidimensional array sort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Ashley,

Monday, March 14, 2005, 12:12:19 PM, you wrote:
A>     I need to do a sort on the whole thing in such a way that:
A>        a) all the Dir#'s are in ascending order, and
A>        b) all the User#'s are in ascending order with each Dir#, and
A>        b) all the File#'s are also in ascending order within each User#


http://us3.php.net/manual/en/function.array-multisort.php


It's funny, I was in the exact same boat this morning with regards to
generating a sign-in sheet for a class where I had pulled out all the
students into a multi-dimensional array and needing to sort them by
last name ascending. I was just about to delve into array-multisort
when it dawned on me that this would be the perfect opportunity for a
table join. So, I learned how to do a MySQL join (my first) a few
hours ago. It works great! Much less headache too.

$sqlRegisteredStudents="SELECT s.id, s.firstName, s.lastName, s.phone, s.email, s.divisionOrFacility, s.supervisorName " .
                        "FROM " . $tbl_registrations . " r JOIN " . $tbl_students . " s " .
                        "ON r.studentId = s.id " .
                        "WHERE courseId='" . $_POST['courseID'] . "' " .
                        "ORDER BY s.lastName ASC";

-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux