I have these two values i want to store:
$a = '51.480092';
$b = '-2.589397';
I have these two values i want to store:
$a = '51.480092';
$b = '-2.589397';
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');