UPDATE语句中的SQl语法错误

时间:2013-05-30 09:08:41

标签: php sql

$sql_select3 = "UPDATE `pdfhash` 
SET `PdfHash` = '$pdf1hash',`DateModified` = '.$date.' 
WHERE `Filename` ='current.pdf'";

此SQL语句返回一个说明此

的错误
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'current.pdf'',`DateModified` = 'Thursday the 30th ' WHERE `Filename` ='.current.' at line 1

4 个答案:

答案 0 :(得分:4)

不正确的引用如下所示,

$sql_select3 = "UPDATE `pdfhash` SET `PdfHash` = '$pdf1hash',
               `DateModified` = " . $date ." 
                WHERE `Filename` ='current.pdf'";

答案 1 :(得分:1)

试试这个

$sql_select3 = "UPDATE `pdfhash` SET `PdfHash` = '".$pdf1hash."',`DateModified` = '".$date."' WHERE `Filename` ='current.pdf'";

这会有所帮助。

答案 2 :(得分:0)

替换

'.$date.'

使用

'".$date."'

答案 3 :(得分:0)

$ sql_select3 =“UPDATE pdfhash SET PdfHash ='$ pdf1hash',DateModified ='”。$ date。“'WHERE Filename ='current.pdf ““;

'$日期'。到

'“。$ date。”'