Hi,
I try the lat and longitude to store in the table
, datatype is POINT !!
$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
i think the way i store is not good.
data type point to store lat and longitude
Mysql
Must something like
$query.=" point = POINT({$latitude},{$longitude}) ";
But message
you have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '},{$latitude})..
so first must find out why the error excist
(mysql beginner)
Must something like
$query.=" point = POINT({$latitude},{$longitude}) ";
But message
you have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '},{$latitude})..
so first must find out why the error excist
(mysql beginner)
// Build the query
$query = "INSERT INTO test SET ";
// IP adres
$ip = $_SERVER['REMOTE_ADDR'];
$query .= "ip = '" . $ip . "',";
$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"];
$query.=" point = POINT({$latitude},{$longitude}) ";
$query .= "`date` = '" . mysql_real_escape_string($form->getValue('date')) . "',";
$query .= "`message` = '" . mysql_real_escape_string($form->getValue('message')) . "';"; // Careful! The last line ends in a semi-colon
// Execute the query
mysql_query($query) or die(mysql_error());
// Close the connection
mysql_close();
}
FYI, your PHP code is using the legacy mysql extension, which has been deprecated for several years, it's currently unmaintained and it triggers notices in PHP/5.5 and PHP/5.6. I suggest you check any manual page of the extension for alternatives and start using prepared statements.
Of course, HeidiSQL has absolutely nothing to do with PHP
Of course, HeidiSQL has absolutely nothing to do with PHP
Please login to leave a reply, or register at first.