I want to print string value inside query. I defined variable in array. On the below main query that is working when I execute query I get result.
$query = "SELECT count, mahkoy_kod , mahkoy_adi, ilce_id, st_x(st_transform(st_centroid(t2.geom),4326)) as lng,st_y(st_transform(st_centroid(t2.geom),4326)) as lat from
(SELECT count(*),t1.knt_f_mahkoy_id FROM a.s_all t1
where st_intersects(t1.geom,st_transform(ST_GeomFromText( format('POLYGON((%s %s, %s %s, %s %s, %s %s,
%s %s))', 29.743849487304715, 41.24992343698962, 28.481108398437527, 41.24992343698962,
28.481108398437527, 40.749326052646055, 29.743849487304715, 40.749326052646055,
29.743849487304715, 41.24992343698962 ), 4326),500000))
group by knt_f_mahkoy_id ) t1
join analiz.k_spt_dis_mah_koy t2 on t1.knt_f_mahkoy_id = t2.mahkoy_kod
where count > 100";
When I use php pdo I get error is
Could not determine data type of parameter $1 Blockquote
It is php code. Here database class used to run query. When I print data with var_dump I get error. How can I solve this problem?
$query = "SELECT count, mahkoy_kod , mahkoy_adi, ilce_id, st_x(st_transform(st_centroid(t2.geom),4326)) as lng,st_y(st_transform(st_centroid(t2.geom),4326)) as lat from
(
SELECT count(*),t1.knt_f_mahkoy_id FROM a.s_all t1
where st_intersects(t1.geom,st_transform(ST_GeomFromText( format('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))',
:long_high, :lat_high, :long_low, :lat_high, :long_low, :lat_low, :long_high, :lat_low, :long_high, :lat_high ), 4326),500000))
group by knt_f_mahkoy_id
) t1
join analiz.k_spt_dis_mah_koy t2 on t1.knt_f_mahkoy_id = t2.mahkoy_kod where count > 100";
$data = Database::query($query, array("long_high"=>$long_high, "lat_high"=>$lat_high, "long_low"=>$long_low, "lat_low"=>$lat_low));