Re: help with sort problem
| From: | Chris Hewitt | Date: | Sun, 12 May 2002 18:30:43 +0000 |
| Subject: | Re: help with sort problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97312@lists.php.net to get a copy of this message | ||
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
Chris
Nick Wilson wrote:
-----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 the php function I need here but am a little lost as to what will happen if there is only one word in the name var. If someone can suggest what I might do that would be great! many thanks... - --Nick Wilson // www.explodingnet.com-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE83pbjHpvrrTa6L5oRAv5XAJsFAXLb0puFyeknXoaGL7rYUHGxVACdHxt8 ej2/Y56p75z5jZ43DvSbDzo= =8rzj -----END PGP SIGNATURE-----