【问题标题】:Code igniter active record - inserting into a Point columnCodeigniter 活动记录 - 插入点列
【发布时间】:2011-09-28 12:06:56
【问题描述】:

我在 MySql 5.1 中有一个具有以下架构的表:

Venue (id, name, location)

其中位置的类型是点。 我正在尝试使用 CodeIgniter 2.0 活动记录插入新记录:

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

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

但我收到以下错误:

无法从数据中获取几何对象 您发送到 GEOMETRY 字段

【问题讨论】:

  • 尝试使用 $this->db->last_query() 回显正在运行的查询;

标签: mysql codeigniter activerecord geometry


【解决方案1】:

试试:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-15
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 2012-12-06
    • 2012-07-09
    相关资源
    最近更新 更多