views:

27

answers:

1

Hello All, Im using zend framework with mysql, im using Zend_Db_Table_Abstract to run queries. i have spatial field in a table :

country;

+------------+---------+------+-----+---------+----------------+ | 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 | | +------------+---------+------+-----+---------+----------------+

im trying to insert a record in this table but i got an error: Zend_Db_Statement_Exception: SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field . by this: $this->insert(array('region_id'=>'1','coordinate'=>"GeomFromText( 'POINT(-12.461334 130.841904)'"));

any help :).

A: 

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

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

:)

dynamic