我正在尝试使用PHP更新列数据,但我收到零错误的分组。
$find= "INSERT INTO closed_route( name, lat, latasal )
SELECT markers.name, markers.lat, user_locationtemp.lat AS some_name
FROM markers, user_locationtemp
WHERE markers.lat LIKE CONCAT( user_locationtemp.lat, "%" )";
$result = mysql_query($find);
答案 0 :(得分:3)
问题在于您的报价。当您编写"%"
时,您将结束以"INSERT
开头的字符串。所以你在两个字符串上运行PHP %
运算符,这是模数。由于"' )"
不是数字,因此将其视为零,因此您将被除以零。
更改为字符串中的单引号:
$find= "INSERT INTO closed_route( name, lat, latasal )
SELECT markers.name, markers.lat, user_locationtemp.lat AS some_name
FROM markers, user_locationtemp
WHERE markers.lat LIKE CONCAT( user_locationtemp.lat, '%' )";
答案 1 :(得分:1)
在%
附近使用单引号
$find= "INSERT INTO closed_route( name, lat, latasal )
SELECT markers.name, markers.lat, user_locationtemp.lat AS some_name
FROM markers, user_locationtemp
WHERE markers.lat LIKE CONCAT( user_locationtemp.lat, '%' )";
$result = mysql_query($find);