基于这张桌子 http://php.net/manual/en/mysqli-stmt.bind-param.php来自 PHP .net :
Type specification chars
Character Description
i corresponding variable has type integer
d corresponding variable has type double
s corresponding variable has type string
b corresponding variable is a blob and will be sent in packets
我写代码:
$stmt = $this->conn->prepare("INSERT INTO days(day,startLocation) VALUES(?,?)");
$stmt->bind_param("ss", $day, $startLocation);
但问题是因为我的数据库使用类型中的 startLocation 字段POINT
, so
如何在mysql中使用POINT数据类型创建bind_param?
您应该使用 MYSQL 函数 POINT 来转换纬度/经度
$stmt = $this->conn->prepare("INSERT INTO days(day,POINT(lat,lon)) VALUES(?,?,?)");
$stmt->bind_param("sdd", $day, $lat, $lon);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)