Home › Forums › Quform PHP › lat and longitude to store in table
Hi,
I try the lat and longitude to store in the table
$user_ip = getenv(‘REMOTE_ADDR’); $geo = unserialize(file_get_contents(“http://www.geoplugin.net/php.gp?ip=$user_ip”)); $latitude = $geo[“geoplugin_latitude”]; $longitude = $geo[“geoplugin_longitude”]; $coords = $geo[‘geoplugin_latitude’] .’, ‘. $geo[‘geoplugin_longitude’];
$query .= “point = ‘” . $coords . “‘,”;
But got this error , someone an idea? Cannot get geometry object from data you send to the GEOMETRY field
It must like:
$query.=” point = POINT({$latitude},{$longitude}) “;
or
$query.=” point = ‘” .POINT({$latitude},{$longitude}). “‘,”;
But got error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax
I dont now how to make a better syntax for the $query ??
Find out. must a comma after $longitude})
$query.=” point = POINT({$latitude},{$longitude}), “;