From: Martin L. <ma...@la...> - 2014-08-27 19:47:57
|
I am using mdbtools to connect to a mdb-file and retrieve some data from a table in the mdbfile. In the table there is a field which contains values like 0.17, 0.25, 0.17, 0.50, 0.75 I see these numbers when looking at the db with MDB Explorer on my MacBook. But when I select the same field with a PDO/ODBC connection in PHP this is the value i get; 000000000000000. When I look up the field information in MDB Explorer this is the information I get; - *Type:* Numeric - *Precision:* 17 - *Scale:* 2 - *Decimal places:* Auto - *Required:* NO With values like 1.25, 1.3, 1.4, 1.2 .... The value I get in PHP; 000000000000001. When I dump the table to a .sql file from MDB Explorer I get values like; 3.60 instead of 000000000000003. It seems like when I get the value to PHP it is rounded down, and zerofilled. Anyone have any suggestions to what might be wrong, and how I could fix this? $query = 'SELECT * FROM Sales'; $db = isset($this->connection) ? $this->connection : $this->openConnection(); $se = $db->prepare($query); $se->execute(); while( $s = $se->fetch(PDO::FETCH_ASSOC) ){ echo $s['HoursWorked']. PHP_EOL;} I have also tried to dump the result, but the value is like that as soon as I fetch it. Here is the connection: new PDO("odbc:DRIVER=MDBTools;DSN=MYMDB;UID=;PWD=;"); I don't know what could be wrong, but perhaps someone here has an idea? Version info: Name : mdbtools Arch : x86_64 Version : 0.6 Release : 0.7.cvs20051109.el6.1 Martin Landsem (+47) 957 06 206 ma...@la... landsemsolutions.no |