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----- > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php