NYCPHP Meetup

NYPHP.org

[nycphp-talk] storing phone numbers in MySQL

Mitch Pirtle mitchy at spacemonkeylabs.com
Wed Mar 10 17:57:32 EST 2004


David Mintz wrote:

>Jeez I'm awful sorry to disturb you again but... you do store them as
>string types, right? If they were actually numeric in the data layer (as
>opposed to the form input) and there were a leading zero somewhere it
>sounds like it could get ugly.
>
(snaps head up)

Uh, er, oh yeah, that's what I meant.

Using QuickForm you can guaranteee getting nothing but numeric input, 
but you cannot store it in the database as integers because of that 
reason - but the solution varies depending upon what database you are 
working with.  Safest to store as char data, unless you want to get funky.

Speaking of funky, I remember once learning how to create my own 
user-defined datatypes by inheriting classes of other types for 
PostgreSQL, but I can't remember the exact sequence of magic 
incantations...  [sound of ruffling pages]  Oh, you could store the 
numbers individually in an array, yuck.  Oh, here's the ditty on PG's 
user defined types:

http://www.postgresql.org/docs/7.4/interactive/xtypes.html

ZZzzzzzzzzzzzzzzz...




More information about the talk mailing list