2
我想从使用codeigniter的mysql数据返回用户json。在MySQL中,我有一个列作为点,当我调用mysql来获取数据时,它看起来像这样当我var_dump
的信息。codeigniter从点获取怪异符号
array(1) { [0]=> object(stdClass)#19 (10) {
["ID"]=> string(1) "1"
["contact_email"]=> string(25) "[email protected]"
["owner_id"]=> string(1) "1"
["point"]=> string(25) "}�#�[email protected]���ޯ�[email protected]"
}
因为点,当我试图JSON编码和解码,并将其发送给用户,我得到NULL
值。 我不知道如何解决这个问题,它是一个代码问题或我如何设置我的数据库。
CREATE TABLE `foo` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`contact_email` varchar(100) NOT NULL,
`owner_id` int(100) NOT NULL,
`point` Point NOT NULL,
PRIMARY KEY (`ID`),
SPATIAL INDEX point_sx (`point`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARACTER SET utf8;
这是插入语句看起来像
INSERT INTO foo (contact_email,owner_id, point) VALUES ('[email protected]', 1, POINT('60.168607847624095','24.932371066131623'));