On Fri, Aug 22, 2008 at 12:28 PM, Afan Pasalic <afan@xxxxxxxx> wrote: > > > tedd wrote: > >> At 8:44 PM -0600 8/21/08, Keith Spiller wrote: >> >>> Hi, >>> >>> RE: Restore Leading Zeros in Zip Codes >>> >>> Does anyone happen to have a script that will restore the leading zeros >>> in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any >>> suggestions? >>> >>> Thanks, >>> >>> Keith >>> >> >> Keith: >> >> Why take them out in the first place? Keep the zip code as a string. After >> all, not all countries use just numbers. >> >> Cheers, >> >> tedd >> > or, if you use US zip codes only, use ZEROFILL feature in mysql? > > -afan > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >From a recent experience, you should all listen to Tedd's advice. I inhereited an application when I came to work at my current job where the developer used an INT(11) mysql column type for zipcodes. Its turned things into a nightmare. We pulll quotes based off distance and calculate that off zip codes. First I found that there are some 4 digit zip codes in other counties, and shipping from Ohio to New Jersey quotes were coming up as thousands of miles and thousands of dollars, when they shouldn't have. Then there was the announcement of expanding into Canada. Then came digging thru all the code trying to redo how zip codes are happening, and ultimately its lead to a rewrite of the system. Do yourself a favor, and use a string type, fix the ones you have with a sprintf() function and be glad you won't have to suffer in the future. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. "Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life."