I loaded the newest version of WAMP and am doing a is_int on data I retrieved from a mySQL tinyint column and I get false. I am using mySQL 5.0. When I ask it it's type it returns string.
Any thouhgts?
Why do I get a string when I retrieve a tinyint column
Moderator: General Moderators
-
etNewPHPDev
- Forum Newbie
- Posts: 1
- Joined: Wed Oct 29, 2008 1:21 pm
Re: Why do I get a string when I retrieve a tinyint column
All data returned in a MySQL result set is a string. You could try is_numeric() to see if it's a numeric string, or do something like this:
Code: Select all
if((int)$result['tinyIntColumn'] == $result['tinyIntColumn'])
{
//do stuff here
}Real programmers don't comment their code. If it was hard to write, it should be hard to understand.