views:

41

answers:

2

I have these two values i want to store:

        $a = '51.480092';
        $b = '-2.589397';
A: 
FLOAT(2,6) signed

http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html

jwandborg
+2  A: 

Use DECIMAL(9, 6)

9 is the total number or digits, 6 is precision.

You need 3 digits for degrees since values from -179 to 179 are possible.

This works on my 5.1.42:

CREATE TABLE coords (lat DECIMAL(9, 6) NOT NULL, lon DECIMAL(9, 6) NOT NULL);

INSERT
INTO    coords
VALUES  ('51.480092', '-2.589397');
Quassnoi