Re: [PHP] help with sort problem

2002-05-13 Thread Chris Hewitt
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

Re: [PHP] help with sort problem

2002-05-12 Thread Jason Wong
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()

RE: [PHP] help with sort problem

2002-05-12 Thread John Holmes
You really want to handle this in your database. If you need data to be in two fields, first name and last name, then put it in your database that way. Save yourself some time. How easy is it to just add another text field in your form, and insert one more variable into the database??? Whatever

RE: [PHP] help with sort problem

2002-05-12 Thread Jason Soza
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

Re: [PHP] help with sort problem

2002-05-12 Thread Nick Wilson
-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

Re: [PHP] help with sort problem

2002-05-12 Thread Nick Wilson
-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