Es gibt zwei Probleme mit Ihrer Implementierung.
Der Grund wird die Werte sowohl auf zwei Stellen hinter dem Komma gerundet werden, ist, dass Sie explizit die Waage als 2.
auch definiert, FLOAT ist ein ungenauer Datentyp in MySQL.
Um beide Probleme zu lösen, sollten Sie den Datentyp DECIMAL mit einer geeigneten Genauigkeit und Skalierung verwenden.
Zum Beispiel so etwas wie diese:
CREATE TABLE `tblGeoCodes` (
`recNo` int(11) NOT NULL AUTO_INCREMENT primary key,
`longLocation` decimal(18,14) DEFAULT NULL,
`latLocation` decimal(18,14) DEFAULT NULL
);
Beispiel:
mysql> CREATE TABLE `tblGeoCodes` (
-> `recNo` int(11) NOT NULL AUTO_INCREMENT primary key,
-> `longLocation` decimal(18,14) DEFAULT NULL,
-> `latLocation` decimal(18,14) DEFAULT NULL
->);
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> insert into tblGeoCodes (longLocation,latLocation) values(-61.45859899999999 , 10.28289);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> select * from tblGeoCodes;
+-------+--------------------+-------------------+
| recNo | longLocation | latLocation |
+-------+--------------------+-------------------+
| 1 | -61.45859899999999 | 10.28289000000000 |
+-------+--------------------+-------------------+
1 row in set (0.00 sec)
mögliches Duplikat von [Welchen idealen Datentyp verwendet man zum Speichern von Breiten-/Längenangaben in einer MySQL-Datenbank?] (Http://stackoverflow.com/questions/159255/what-is-the-ideal-data-type) to-use-when-storing-Längengrad-in-a-mysql) – Gajus