Mark wrote:
I have a field called name which stores a person's first, middle and last name.

Previously, these names (17800 of them) were entered in the database by different people so there was no consistency in the format used. There are now names entered such as:

Smith, John S.
Doe - Jane W.
Doe John


Try this page with several examples and see if it will do what you want it to do.

http://hrrdb.com/FormatName.php

The main line of code that does the work is...

$FormatedName = preg_replace('/^([A-Za-z]+)([^a-zA-Z]+)(.*)$/', '$1, $3', $FullName);




--
Chris W
KE5GIX

"Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm";

Gift Giving Made Easy
Get the gifts you want & give the gifts they want One stop wish list for any gift, from anywhere, for any occasion!
http://thewishzone.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to