Search code examples
mysqlcodeignitergeolocationpolygon

how do i insert a polygon point in mysql geometric column using codeigniter?


what is wrong with my code?

$this->db->query("update profile set polygon = POLYGON((0 0,82 33,23 66,0 0)) where id = 1");

polygon is a column with type of geometric(polygon). i paste this "POLYGON((0 0,82 33,23 66,0 0))" in that column in phpmyadmin and it is saved but wuth query it in not work


Solution

  • I found the answer

    $this->db->query("update profile set polygon = ST_GeomFromText('POLYGON((0 0,82 33,23 66,0 0))') where id = 1");