PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
robster
Forum Contributor
Posts: 360 Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia
Post
by robster » Wed Sep 21, 2005 12:43 am
How do you do that?!
I've got a database field with text in it which is now slowly being replaced by an integer reference instead.
What I'm trying to do is this kind of error checking:
Code: Select all
if field data IS NOT an INT
{
do stuff with a function that expects an INT
}
else
{
echo "this is old data";
}
So, how does one read a value and determine if there's text or an integer in there?
bizzarro!!
Rob
Last edited by
robster on Wed Sep 21, 2005 12:47 am, edited 1 time in total.
hawleyjr
BeerMod
Posts: 2170 Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA
Post
by hawleyjr » Wed Sep 21, 2005 12:45 am
robster
Forum Contributor
Posts: 360 Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia
Post
by robster » Wed Sep 21, 2005 12:47 am
is there NOTHING that is not easily do-able with PHP?! LOL
Thank you so much. They've thought of everything have they not!?
(looks like this is the function I'm after btw, very similar, but slightly different:
http://us3.php.net/manual/en/function.is-numeric.php )
rob
hawleyjr
BeerMod
Posts: 2170 Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA
Post
by hawleyjr » Wed Sep 21, 2005 1:14 am
Is Numeric and is Int are two different things...
robster
Forum Contributor
Posts: 360 Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia
Post
by robster » Wed Sep 21, 2005 1:25 am
true, I think I asked my question slightly incorrectly.
It was the ability to test for a numeric value rather than an INT value.
But I was lead straight to the answer, which I really appreciate.
Thanks again,
rob