每当我尝试从PHP更新选定行中的列时,它都会顺利通过,但不会在数据库中更新。
$query = "UPDATE news SET title = '$title',
cover = '$cover', desc = '$newz', category = '$category'
WHERE id = $newz_select_id";
答案 0 :(得分:4)
desc
是 reserved keyword in MySQL 。用反引号(`)代替它。
$query = "UPDATE news SET title = '$title',
cover = '$cover', `desc` = '$newz', category = '$category'
WHERE id = $newz_select_id";
顺便说一句,你的代码很容易被sql注入。为了避免它,请学习并使用PHP PDO或PHP mySQLi Extensions。