我似乎找不到成功准备使用 POINT 数据类型的语句的记录。
上一个问题(如何将 POINT mysql 类型与 mysqli - php 一起使用 https://stackoverflow.com/questions/27323915/how-to-use-point-mysql-type-with-mysqli-php)显示标记为正确的内容,但它不起作用。我什至尝试在他们的示例中使用他们的简单查询:
$stmt = $this->conn->prepare("INSERT INTO days(day,POINT(lat,lon)) VALUES(?,?,?)");
$stmt->bind_param("sdd", $day, $lat, $lon);
这只是简单地返回和错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(lat,lon)) VALUES(?,?,?)' at line 1
尝试如下;
$stmt = $this->conn->prepare("INSERT INTO days(day,column_name) VALUES(?,POINT(?,?))"); //column_name is name of of column that you want to insert POINT(lat,lon)
$stmt->bind_param("sdd", $day, $lat, $lon);
$stmt->execute();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)