我正在抓我的頭使這行代碼工作,但沒有成功......如果有人能指出什麼是最佳做法寫這樣的查詢?不能讓mysql查詢使用雙或單qoute工作
if(isset($_POST) && $_POST["id"] > 0)
{
include('../../config.php');
$id = $_POST["id"];
$title = mysql_real_escape_string($_POST["title"]);
$desc = mysql_real_escape_string($_POST["desc"]);
$cat = $_POST["catid"];
$_DB->Execute("UPDATE gallery_imgs SET title = `$title`, description = `$desc` WHERE id = $id");
header("location: admin.php?mode=images&id=$cat");
}
else
{
//Other stuff!
}
這是我的錯誤:
Error number: 1054
Error : Unknown column 'The SIEK!' in 'field list'
謝謝!也爲旁註! – 2012-03-10 17:43:00
如果$ title是「'現在不要看!」會發生什麼?哎呀。當然你至少應該提到'mysql_escape_string()'! – TerryE 2012-03-10 19:08:56
@TerryE OP已經在標題和描述中調用了'mysql_real_escape_string()'。看到上面的原始帖子... – 2012-03-10 19:12:16