gpt4 book ai didi

php - 从数组更新表sql时出错

转载 作者:行者123 更新时间:2023-11-29 05:22:18 25 4
gpt4 key购买 nike

<分区>

我有一个 sql 代码,这个代码更新 hitung 列中的 open_list 表。

$hitung=mysql_query("select markers_tujuan.lng,markers_tujuan.lat,open_list.lat, open_list.lng,
((SQRT((((markers_tujuan.lat-markers_tujuan.lng)*(markers_tujuan.lat-markers_tujuan.lng)) + ((open_list.lat-open_list.lng)*(open_list.lat-open_list.lng)))))+(sqrt((((markers_tujuan.lat-open_list.lat)*((markers_tujuan.lat-open_list.lat)))+((markers_tujuan.lng-open_list.lng)*((markers_tujuan.lng-open_list.lng))))))) as hasil
from markers_tujuan, open_list");
$op=mysql_query("select * from open_list");

/* fetch associative array */
while ($row = mysql_fetch_assoc($hitung)) {
//printf ("(%s %s),(%s %s),%s <br> \n", $row["lng"], $row["lat"], $row["lat"], $row["lng"], $row["hasil"]);
while ($baris=mysql_fetch_assoc($op)){
//printf ("(%s %s %s %s) <br> \n", $baris["name"], $baris["lat"], $baris["lng"], $baris["hitung"]);

$try=mysql_query(" UPDATE open_list SET '$baris["hitung"]' = '".$row["hasil"]."' ");
}
}

我已经试过了,但我遇到了一个虚拟错误,我找不到它。这让我发疯

Parse error: syntax error, unexpected '"', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) 

这是错误行

$try=mysql_query(" UPDATE open_list SET '$baris["hitung"]' = '".$row["hasil"]."' ");

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com