php-db | 2001041
Date: 04/05/01
- Next message: Andrew Hill: "RE: [PHP-DB] Oracle vs MS SQL vs MySQL"
- Previous message: Florian Clever: "[PHP-DB] Oracle vs MS SQL vs MySQL"
- Next in thread: Boclair: "Re: [PHP-DB] Forms : Validating user input is integer"
- Reply: Boclair: "Re: [PHP-DB] Forms : Validating user input is integer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
----- Original Message -----
From: Matt Williams <matt <email protected>>
To: boclair <boclair <email protected>>
Sent: Thursday, April 05, 2001 9:03 PM
Subject: RE: [PHP-DB] Forms : Validating user input is integer
>
> > To gain the full benefit of your suggestion I find that I can
validate
> > for a wrong entry containing a mix alphabetical and numerical
> > characters by altering the elseif line to read
> >
> > elseif (!eregi("[0-9]",$num) || eregi("[a-z]",$num))
> >
> > Agreed?
> >
>
> mmmm yes and no.
>
> I've done a lot of testing for this and using just the first one has
never
> let any values of $num through unles they've contained only numbers.
> AFAIK (!eregi("[0-9]",$num) should always return false or 0 or
whatever it
> is unless it contains only numbers.
xxxxxxxxxxxx
When I used only elseif (!eregi("[0-9]",$num) { }
an input 2i passed the variable 2
xxxxxxxxxxxx
> You could also use [^a-zA-Z] for letters you don't want.
> so maybe something like (!eregi("([0-9]||[^a-zA-Z])",$num))
> not tried so don't rely on that.
xxxxxxxxxxxxxx
correcting some typos this does the job elegantly. Should read
elseif (!eregi(("[0-9]" || "[^a-zA-Z]"),$num)){ }
xxxxxxxxxxxxxx
> Check out the phpbuilder.com regexp tutorial, I find it a good
resource
> http://www.phpbuilder.com/columns/dario19990616.php3
Have read it and got confused. Will re-read it with my eyes open.
Thanks for holding my hand.
Tim
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andrew Hill: "RE: [PHP-DB] Oracle vs MS SQL vs MySQL"
- Previous message: Florian Clever: "[PHP-DB] Oracle vs MS SQL vs MySQL"
- Next in thread: Boclair: "Re: [PHP-DB] Forms : Validating user input is integer"
- Reply: Boclair: "Re: [PHP-DB] Forms : Validating user input is integer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

