Nick,
I would use two fields in the database, FirstName and LastName. The
LastName should be mandatory in your input from the user. Then you can
simply extract the data with an sql statement that uses order by
LastName. If you have a significant number of records, this will be
fastest.
HTH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi all,
I hope someone might help me with a little puzzle...
I have bunch of db results and one of the fields is 'name',
I want to see if there are 2 parts to it like FirstName LastName and if
so order by the last name.
I can see explode() being
On Monday 13 May 2002 00:23, Nick Wilson wrote:
Hi all,
I hope someone might help me with a little puzzle...
I have bunch of db results and one of the fields is 'name',
I want to see if there are 2 parts to it like FirstName LastName and if
so order by the last name.
I can see explode()
kind of hack you come up with in PHP is going to be a waste
of time and memory.
---John Holmes...
-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 12, 2002 9:23 AM
To: php-general
Subject: [PHP] help with sort problem
-BEGIN PGP SIGNED MESSAGE
and using PHP to do this for me seemed to be the easier
choice. It's not, and doing it that way is far from efficient.
HTH,
Jason Soza
-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 12, 2002 1:26 PM
To: 'PHP-General'
Subject: RE: [PHP] help with sort problem
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then John Holmes declared
Whatever kind of hack you come up with in PHP is going to be a waste
of time and memory.
Depends on your view point, the client was happy with one field for the
name and now wants the records returned sorted
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Jason Wong declared
If that is what you want then:
while (names) {
explode the name
if there is more than one element swap it, then join
add this processed name onto a new array
}
use one of the array sort functions to
7 matches
Mail list logo