I have a project made in flex, using PHP data services to access an SQL server database, and I need to convert it to MySQL, I have changed all my PHP services from sqlsrv to mysqli.
Something like this:
$this->connection = mysqli_connect(SERVER,USERNAME,PASSWORD,DATABASE); // Start Connection
$ssqlstring = "select * from Users";
$runssql = mysqli_query($this->connection, $ssqlstring);
while($user = mysqli_fetch_array($runssql))
{
$users[$user["ID"]] = $user;
}
return $users;
It worked fine on sqlsrv but with mysqli it returns to flex the INT, BIT, or DATE values as string
the main Datatypes on MySQL are INT, VARCHAR, BIT(1), DATETIME, DATE (same as sqlsrv)
and on the flex the return types are mainly as object[]
from the manual
There are relatively few native types in PHP, in short, possibles are INT, FLOAT and STRING (where STRING is the default for all the rest, like BIT and DATE etc.).
PDOis a bit better at using more close-to-actual types, but still defaults to strings a lot. Inmysqli, you could usemysqli_result_fetch_fieldsto get the type of field returned, and cast it to a desired format, see also theMYSQLI_TYPE_*constants.