Re: Telephone number column not working

2004-10-02 Thread Paul DuBois
At 5:26 -0700 10/2/04, Stuart Felenstein wrote:
--- Paul DuBois <[EMAIL PROTECTED]> wrote:
 Are you trying to store telephone number values with
 the intermediate dashes? Such values are not
 actually
 numbers. You'll need to store them as strings, or
 else remove the dashes.

Yes, they made all the difference. 
Set the field type to varchar, and the input type to
string.  Correct numbers including hyphens now in
database.

Wondering about one more issue, could changing this to
input string, leave me open to some type of SQL
injection ?
Sure.  That's always true for anything that's a string.
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Telephone number column not working

2004-10-02 Thread Patrick Sherrill
Given the many 'standards' for formatting phone numbers, I would recommend 
using a char or varchar.  Regex is intended for string types.
Do yourself a favor run an alter table and change the column to a char or 
varchar.

I hope this helps...
Pat...
[EMAIL PROTECTED]
CocoNet Corporation
SW Florida's First ISP
- Original Message - 
From: "GH" <[EMAIL PROTECTED]>
To: "Stuart Felenstein" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, October 02, 2004 8:09 AM
Subject: Re: Telephone number column not working


One issue could be that an int column unsigned can only hold up to
4294967295 a ten digit number. Plus if you put it in a context of a
phone number... only area codes 428 or lower will have ALL THE
EXCHANGES and ALL THE UNIQUE NUMBERS in the range... with part of area
code 429
A bigint will hold the complete range you are looking for However,
I would sugest that since you mostlikely are not going to be doing
mathematical operations on a phone number that you use a varchar or
char field.
Maybe someone could correct me but aren't regex for strings only?
Gary

On Sat, 2 Oct 2004 04:59:45 -0700 (PDT), Stuart Felenstein
<[EMAIL PROTECTED]> wrote:
I have a field "telephone".
Set to type :int:
Length: 11
It's  not working correctly, and not sure if it's my
application or something I have wrongly set up for the
database.
We are talking about U.S. Telephone numbers here, so 7
digits (area code, exchange, unique number)
Now it seems everything works up to the storing of 6
numbers.  Once I add the 7th number, everything goes
haywire.  The number gets transformed to some totally
different number and / or 0 (zero).
Now I had set up a validation , which I think would be
correct for a U.S. number:
[0-9\+\-\/ \(\)\.]+
Yet, even if I remove that regexp and let it validate
solely on integers: -{0,1}\d+
Nothing.
I thought perhaps enforcing the field to unsigned
might help, but no change.
One last note, I've "now" added some javascript to
enforce format.  This hasn't changed anything , better
or worse.  Same behaviour.  This is solely for making
sure client enters 111-111- format.  Just wanted
to include this in my information.
Well if anyone has a clue appreicate the help.
Stuart
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

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

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


Re: Telephone number column not working

2004-10-02 Thread Martijn Tonies



> I have a field "telephone".
> Set to type :int:
> Length: 11

You cannot store a phone-number in an "int".

Use (var)char.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com



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



Re: Telephone number column not working

2004-10-02 Thread Stuart Felenstein

--- Paul DuBois <[EMAIL PROTECTED]> wrote:

> Are you trying to store telephone number values with
> the intermediate dashes? Such values are not
> actually
> numbers. You'll need to store them as strings, or
> else remove the dashes.


Yes, they made all the difference.  
Set the field type to varchar, and the input type to
string.  Correct numbers including hyphens now in
database.

Wondering about one more issue, could changing this to
input string, leave me open to some type of SQL
injection ?

Stuart

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



RE: Telephone number column not working

2004-10-02 Thread Peter Lovatt
Hi

could it be that the - or a space is upsetting things?

111-111- might be calculated to give -

or if the user enters a space it is no longer an integer

unless you need it to be an integer,  telephone numbers are usually stored
as a char type

HTH

Peter



> -Original Message-
> From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
> Sent: 02 October 2004 13:00
> To: [EMAIL PROTECTED]
> Subject: Telephone number column not working
>
>
> I have a field "telephone".
> Set to type :int:
> Length: 11
> It's  not working correctly, and not sure if it's my
> application or something I have wrongly set up for the
> database.
> We are talking about U.S. Telephone numbers here, so 7
> digits (area code, exchange, unique number)
>
> Now it seems everything works up to the storing of 6
> numbers.  Once I add the 7th number, everything goes
> haywire.  The number gets transformed to some totally
> different number and / or 0 (zero).
>
> Now I had set up a validation , which I think would be
> correct for a U.S. number:
>
> [0-9\+\-\/ \(\)\.]+
>
> Yet, even if I remove that regexp and let it validate
> solely on integers: -{0,1}\d+
>
> Nothing.
> I thought perhaps enforcing the field to unsigned
> might help, but no change.
>
> One last note, I've "now" added some javascript to
> enforce format.  This hasn't changed anything , better
> or worse.  Same behaviour.  This is solely for making
> sure client enters 111-111- format.  Just wanted
> to include this in my information.
>
> Well if anyone has a clue appreicate the help.
>
> Stuart
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
>



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



Re: Telephone number column not working

2004-10-02 Thread Paul DuBois
At 4:59 -0700 10/2/04, Stuart Felenstein wrote:
I have a field "telephone".
Set to type :int:
Length: 11
It's  not working correctly, and not sure if it's my
application or something I have wrongly set up for the
database.
We are talking about U.S. Telephone numbers here, so 7
digits (area code, exchange, unique number)
Are you trying to store telephone number values with
the intermediate dashes? Such values are not actually
numbers. You'll need to store them as strings, or
else remove the dashes.
Now it seems everything works up to the storing of 6
numbers.  Once I add the 7th number, everything goes
haywire.  The number gets transformed to some totally
different number and / or 0 (zero).
Now I had set up a validation , which I think would be
correct for a U.S. number:
[0-9\+\-\/ \(\)\.]+
Yet, even if I remove that regexp and let it validate
solely on integers: -{0,1}\d+
Nothing.
I thought perhaps enforcing the field to unsigned
might help, but no change.
One last note, I've "now" added some javascript to
enforce format.  This hasn't changed anything , better
or worse.  Same behaviour.  This is solely for making
sure client enters 111-111- format.  Just wanted
to include this in my information.
Well if anyone has a clue appreicate the help.
Stuart

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Telephone number column not working

2004-10-02 Thread Stuart Felenstein
I guess that is why if I enter 703111
I get this back - 4294967295

Stuart


--- GH <[EMAIL PROTECTED]> wrote:

> One issue could be that an int column unsigned can
> only hold up to
> 4294967295 a ten digit number. Plus if you put it in
> a context of a
> phone number... only area codes 428 or lower will
> have ALL THE
> EXCHANGES and ALL THE UNIQUE NUMBERS in the range...
> with part of area
> code 429
> 
> A bigint will hold the complete range you are
> looking for However,
> I would sugest that since you mostlikely are not
> going to be doing
> mathematical operations on a phone number that you
> use a varchar or
> char field.
> 
> Maybe someone could correct me but aren't regex for
> strings only?
> 
> 
> Gary
> 
> 
> 
> 
> On Sat, 2 Oct 2004 04:59:45 -0700 (PDT), Stuart
> Felenstein
> <[EMAIL PROTECTED]> wrote:
> > I have a field "telephone".
> > Set to type :int:
> > Length: 11
> > It's  not working correctly, and not sure if it's
> my
> > application or something I have wrongly set up for
> the
> > database.
> > We are talking about U.S. Telephone numbers here,
> so 7
> > digits (area code, exchange, unique number)
> > 
> > Now it seems everything works up to the storing of
> 6
> > numbers.  Once I add the 7th number, everything
> goes
> > haywire.  The number gets transformed to some
> totally
> > different number and / or 0 (zero).
> > 
> > Now I had set up a validation , which I think
> would be
> > correct for a U.S. number:
> > 
> > [0-9\+\-\/ \(\)\.]+
> > 
> > Yet, even if I remove that regexp and let it
> validate
> > solely on integers: -{0,1}\d+
> > 
> > Nothing.
> > I thought perhaps enforcing the field to unsigned
> > might help, but no change.
> > 
> > One last note, I've "now" added some javascript to
> > enforce format.  This hasn't changed anything ,
> better
> > or worse.  Same behaviour.  This is solely for
> making
> > sure client enters 111-111- format.  Just
> wanted
> > to include this in my information.
> > 
> > Well if anyone has a clue appreicate the help.
> > 
> > Stuart
> > 
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> > 
> >
> 


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



Re: Telephone number column not working

2004-10-02 Thread GH
One issue could be that an int column unsigned can only hold up to
4294967295 a ten digit number. Plus if you put it in a context of a
phone number... only area codes 428 or lower will have ALL THE
EXCHANGES and ALL THE UNIQUE NUMBERS in the range... with part of area
code 429

A bigint will hold the complete range you are looking for However,
I would sugest that since you mostlikely are not going to be doing
mathematical operations on a phone number that you use a varchar or
char field.

Maybe someone could correct me but aren't regex for strings only?


Gary




On Sat, 2 Oct 2004 04:59:45 -0700 (PDT), Stuart Felenstein
<[EMAIL PROTECTED]> wrote:
> I have a field "telephone".
> Set to type :int:
> Length: 11
> It's  not working correctly, and not sure if it's my
> application or something I have wrongly set up for the
> database.
> We are talking about U.S. Telephone numbers here, so 7
> digits (area code, exchange, unique number)
> 
> Now it seems everything works up to the storing of 6
> numbers.  Once I add the 7th number, everything goes
> haywire.  The number gets transformed to some totally
> different number and / or 0 (zero).
> 
> Now I had set up a validation , which I think would be
> correct for a U.S. number:
> 
> [0-9\+\-\/ \(\)\.]+
> 
> Yet, even if I remove that regexp and let it validate
> solely on integers: -{0,1}\d+
> 
> Nothing.
> I thought perhaps enforcing the field to unsigned
> might help, but no change.
> 
> One last note, I've "now" added some javascript to
> enforce format.  This hasn't changed anything , better
> or worse.  Same behaviour.  This is solely for making
> sure client enters 111-111- format.  Just wanted
> to include this in my information.
> 
> Well if anyone has a clue appreicate the help.
> 
> Stuart
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
> 
>

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



Telephone number column not working

2004-10-02 Thread Stuart Felenstein
I have a field "telephone".
Set to type :int: 
Length: 11
It's  not working correctly, and not sure if it's my
application or something I have wrongly set up for the
database. 
We are talking about U.S. Telephone numbers here, so 7
digits (area code, exchange, unique number)

Now it seems everything works up to the storing of 6
numbers.  Once I add the 7th number, everything goes
haywire.  The number gets transformed to some totally
different number and / or 0 (zero).

Now I had set up a validation , which I think would be
correct for a U.S. number:

[0-9\+\-\/ \(\)\.]+

Yet, even if I remove that regexp and let it validate
solely on integers: -{0,1}\d+

Nothing.
I thought perhaps enforcing the field to unsigned
might help, but no change.

One last note, I've "now" added some javascript to
enforce format.  This hasn't changed anything , better
or worse.  Same behaviour.  This is solely for making
sure client enters 111-111- format.  Just wanted
to include this in my information.

Well if anyone has a clue appreicate the help.

Stuart


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