Page 1 of 1
Why do I get a string when I retrieve a tinyint column
Posted: Wed Oct 29, 2008 1:24 pm
by etNewPHPDev
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?
Re: Why do I get a string when I retrieve a tinyint column
Posted: Wed Oct 29, 2008 1:50 pm
by pickle
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
}