fyi...Swati is a girl not a guy =)
Lenny Gemar wrote:
Swati didn't reply to this list, but I was able to get the info from him. Here is how he converted 1234567890 to 123-456-7890 (actually this is my adaptation, but whatever...)
$Phone = $row["PhonePublished"];
$PhoneAC = substr("$Phone", 0, 3);
$PhonePrefix = substr("$Phone", 3, 3);
$PhoneSuffix = substr("$Phone", 6, 4);
$Phone = $PhoneAC."-".$PhonePrefix."-".$PhoneSuffix;
The source MySQL field is PhonePublished. The next three lines create separate variables for each section of the phone number. The last line formats $Phone to add dashes between the area code, prefix, and suffix. You could easily modify this to follow the format (123) 456-7890 as well.
To convert (123) 456-7890 to 1234567890 within your database, you could use:
$Phone = ereg_replace( "[0-9]", "", $Phone);
Anything that is not a digit from 0-9 is
replaced with "".
I hope this helps someone.
Regards,
Lenny
LennyG@netbox.com