Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing the Latitude and longitude values in Mysql Geomfromtext Point format using yii2 insert query

Tags:

php

mysql

yii2

I am trying to store the Latitude and longitude values in Mysql Geomfromtext Point format using yii2 insert query.

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

But it is not working.It throws some error.I dont know how to store the coordinates in mysql in point format.My field datatype is POINT(Geomfromtext).I am trying this for the past 7 days,bt i din get any idea.Pls help me out if anybody have an idea to solve this.Thanks in advance!!

I am storing the values in database as follows:

enter image description here

like image 812
Deeban Babu Avatar asked Nov 09 '22 02:11

Deeban Babu


1 Answers

I tried using the above code.But i am not getting the correct result.So i used simple code to solve this.

 $connection = \Yii::$app->db;
 $command = $connection->createCommand('INSER INTO tbl_name(NORTHING_EASTING) VALUES(POINT(43.005895,-71.013202))');
 $command->execute();
like image 153
Murali Raj Avatar answered Nov 14 '22 23:11

Murali Raj