开发者

Code igniter active record - inserting into a Point column

I have a table with the following schema in MySql 5.1:

Venue (id, name, location)

where location is of type Point. I am trying to insert a new record using 开发者_如何学编程the CodeIgniter 2.0 active records:

$row = array("id" => $id, "name" => $name, "location" => 
"GeomFromText('POINT(1 1)')" );

$this->db->insert('Venues', $row); 

but i get the following error:

Cannot get geometry object from data you send to the GEOMETRY field


Try:

$this->db->set("id",$id);
$this->db->set("name",$name);
$this->db->set("location",'geomfromtext("POINT(1 1)")',false);
$this->db->insert("Venues");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜