PDO mysql query returns int field into a String type solutions
when using PDO mysql database queries, execute prepare, after execute, the return of all field data into a character.
For example Int id is in the database, the query returns a String type.
For this PHP weakly typed language, has little effect. In doing API returns data if the type is inconsistent with the database, Java and Objective C for these types of strong influence on the great.
<pre>
<PHP?
$ PDO = new new PDO ($ DSN, the User $, $ Pass, $ param);
// create a connection after adding
$ PDO-> setAttribute (PDO :: ATTR_STRINGIFY_FETCHES, false);
$ PDO-> setAttribute (PDO :: ATTR_EMULATE_PREPARES, false);
>?
</ Pre>
the role of these two settings
PDO: : ATTR_STRINGIFY_FETCHES extracted when the value into a string.
PDO :: ATTR_EMULATE_PREPARES enable or disable analog prepared statement.