Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php UPDATE语句中的SQl语法错误_Php_Sql - Fatal编程技术网

Php UPDATE语句中的SQl语法错误

Php UPDATE语句中的SQl语法错误,php,sql,Php,Sql,此SQL语句返回这样一个错误 $sql_select3 = "UPDATE `pdfhash` SET `PdfHash` = '$pdf1hash',`DateModified` = '.$date.' WHERE `Filename` ='current.pdf'"; 不正确的引用使用方式 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server

此SQL语句返回这样一个错误

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

不正确的引用使用方式

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
替换

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

试试这个

'".$date."'
这将有所帮助。

$sql\u select3=“更新
pdfhash
SET
pdfhash
='pdf1hash',
DateModified
='”“$date.”其中
Filename
='current.pdf'

“.$date.”至


'“$date.”

显示没有php变量的精确查询设置此错误:您的SQL语法有错误;请查看与MySQL服务器版本对应的手册,以了解在第1行“current.pdf”“DateModified=30号星期四”附近使用的正确语法,
DateModified='$date'
不使用dotsError:您的SQL语法有错误;查看与MySQL服务器版本对应的手册,以了解在“current.pdf”附近使用的正确语法,
DateModified
=“30日星期四”第1行您需要转义“current.pdf”,因为他看不懂点当前\.pdf'
'".$date."'
$sql_select3 = "UPDATE `pdfhash` SET `PdfHash` = '".$pdf1hash."',`DateModified` = '".$date."' WHERE `Filename` ='current.pdf'";