Jump to content

strange query result


jimfog

Recommended Posts

I have a 3-col table.

 

One of the columns is INT type.

 

My problem has to when fetching data from this table.

The strange thing(I used var_dump to do the testing) that the INT comes as a string

 

For example in the database table at the specific col there is the value 2.

Running a SELECT query will bring back "2".

 

Why this might be happening?

 

I am not posting any code-yet-cause I do not know if it is going to be of any use.

 

 

Link to comment
Share on other sites

Once upon a time I wrote a function that took a table name and a multidimensional array of records, and it would look up the column types in the table and convert the values in the records to the closest native PHP type. You could do something similar if you want things to not be strings.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...