all data type in PHP PDO query to ms access are strings? Need help to retrieve numeric types
I'm trying to connect from PHP to a ms access database and, with help from here, so far so good!
But all data retrieved is "String" type, even date/time and numeric fields are converted to string in php. And some numeric values only show a string with "E2".
Here is my code:
$dbName = "database.accdb";
$conn2 = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=$dbName;Uid=Admin");
$conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn2->prepare("SELECT * FROM table");
$stmt->execute();
$result= $stmt->fetchAll();
There are numeric fields, string fields, and date/time fields in that table, but the array $result has data type "String" in all elements. Used gettype() to check.
The problem is that numeric values get converted sometimes to "0.0353125" (for example) or only "E-3" or "E-2"
How can I get the correct value in my $result array? What am I doing wrong?
Thanks a lot