Saving latitude and longitude values ​​in the Mysql Geomfromtext Point format using the yii2 insert query

I am trying to save latitude and longitude values ​​in the Mysql Geomfromtext Point format using the yii2 insert query.

$column_name->NORTHING_EASTING = POINT(43.005895,-71.013202); 

But it does not work. It gives out some error. I do not know how to store coordinates in mysql in dot format. My field data type is POINT (Geomfromtext). I have been trying this for the last 7 days, bt i din get any idea .Pls help me if anyone has an idea to solve this problem. Thanks in advance.

I store the values ​​in the database as follows:

enter image description here

+5
source share
1 answer

I tried using the above code. But I do not get the correct result. So I used simple code to solve this problem.

  $connection = \Yii::$app->db; $command = $connection->createCommand('INSER INTO tbl_name(NORTHING_EASTING) VALUES(POINT(43.005895,-71.013202))'); $command->execute(); 
+1
source

Source: https://habr.com/ru/post/1234520/


All Articles