gpt4 book ai didi

php - zend 框架与空间

转载 作者:行者123 更新时间:2023-12-02 01:21:46 27 4
gpt4 key购买 nike

我正在使用 zend 框架和 MySQL。我正在使用 Zend_Db_Table_Abstract 来运行查询。我的表中有一个空间字段:

国家/地区:

+------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| region_id | int(5) | NO | | NULL | |
| coordinate | point | NO | MUL | NULL | |
+------------+---------+------+-----+---------+----------------+

我试图在此表中插入一条记录,但出现错误:

Zend_Db_Statement_Exception: SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field .

通过这个:

$this->insert(array('region_id'=>'1','coordinate'=>"GeomFromText( 'POINT(-12.461334 130.841904)'"));

有人可以帮忙吗?

最佳答案

$coordinate  = "GeomFromText( 'POINT(-12.461334 130.841904)')"; 

$this->insert(array('region_id'=>'1','coordinate'=>new Zend_Db_Expr($coordinate)));

关于php - zend 框架与空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3303170/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com