I’m trying to get data form spacial db. I use
SELECT gid, ST_X(geom), ST_Y(geom), ST_AsText(geom)
to get points data (and give readable lat/lon) in pgAdmin.
How can I get the same data using yii. I have tried
$posts = Yii::$app->db->createCommand('SELECT gid, ST_X(geom), ST_Y(geom), ST_AsText(geom)
But i do not get anything. Suggetions???
I’ve tested it on my side.
The function (MySQL):
CREATE FUNCTION GETFULLNAME(fname CHAR(250),lname CHAR(250))
DECLARE fullname CHAR(250);
SET fullname=CONCAT(fname,' ',lname);
$posts = Yii::$app->db->createCommand('select GETFULLNAME(name,photo) from test_table')->queryAll();
'GETFULLNAME(name,photo)' => string 'test2 test1' (length=11)
I am aware yoy have been using Postgres. Nevertheless check it twice. Maybe you have mistaken something.
It was a mistake. I was getting correct data, but I was not able to see data in the current view. I created a new view with just print print_r and echo functions to verify data I was getting. Thank you.