0
嗨,大家好,我有一個在PHP更新記錄查詢問題。Mysql查詢更新從PHP
<?php
include('../webcgo/script/cox.php');
$query = $cox->query("SELECT cf_id FROM offerte;");
while ($idx = mysqli_fetch_array($query)) {
$check = '<button class="uk-button" onclick="location.href=\'http://localhost/chartscript/remRegola.php?dis=2&id=' . $idx['cf_id'] . '\'">OK</button>';
$query_check = 'UPDATE offerte SET check=\'' . $check . '\' WHERE cf_id=' . $idx['cf_id'].';';
if ($queryx = $cox->query($query_check) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $cox->error;
}
}
mysqli_close($cox);?>
結果: 錯誤更新記錄:您的SQL語法錯誤;檢查對應於您的MySQL服務器版本的手冊,以便在'check ='處使用正確的語法'
如果你回聲'$ query_check'你? –
'check'是[保留字](http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html) –