views:

64

answers:

1

Hi,

I'd like to know if there is a simple way to fetch data from mysql tables with "correct" data types? What i mean, if field type is for example INT or SMALLINT is it possible to pass those types directly to PHP as integers?

I did some searching and found mysqli_fetch_fields, but for SMALLIT type is 2, for INT 3 and so on. It could be done that way, but it looks rather clumsy workaround. Is there any better way?

I'm using PHP and mysqli.

Thank you.

+2  A: 

The most straightforward way is to build your own database handler on top of the mysqli calls that does that for you.

staticsan