poing
Posts: 1
|
| Posted: 04/14/2009, 6:46 PM |
|
I am having issues getting CCS to properly format a 10 digit number without dropping the leading zeros. I am using: CCS 4.2.00.040/mySQL/PHP
The mySQL table is configured to return the leading zero using 'zerofill', but it looks like CCS is stripping it away whenever the value is treated as an integer.
mySQL: number INT(10) ZEROFILL NOT NULL COMMENT 'Phone Number'
CCS Format: ##-####-####
If I change the 'Data Type' to text, it will display the leading zero. But then I can't use CCS format property.
My best guess is, its how the PHP is handling the integer. So I may be stuck with something complicated like SELECT CONCAT(LEFT(number,2), '-', MID(number,3,4), '-', RIGHT(number,4)) every time I need to format a phone number.
Of course I could also create a function to do most of the work for me, but I am trying to avoid creating custom queries every time I want to format a phone number field.
While there are plenty of workarounds, does anyone have a suggestion on how to get CCS to handle the formatting with the leading zero?
Thanks,
Brian LaVallee
|
 |
 |
datadoit
|
| Posted: 04/15/2009, 6:59 AM |
|
http://us2.php.net/sprintf
|
|
|
 |
|