jimfog Posted September 18, 2014 Share Posted September 18, 2014 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 More sharing options...
Ingolme Posted September 18, 2014 Share Posted September 18, 2014 All results received from the database in PHP are strings. INT just tells the database how to handle and store the data. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 18, 2014 Share Posted September 18, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now