我的网站上有更新功能,当我运行update.php时出现错误。
(这是错误)
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\Xampp\htdocs\DBLogistic\update.php on line 9
(这是我的update.php)
<?php
include('connectdb.php');
if (isset($_POST['update'])) {
$sql ="UPDATE tbluser SET userNm='$_POST['newname']', userFullNm='$_POST['newfullname']', userEmail='$_POST['newemail']', userPhone='$_POST['newcontact']', userLvlId='$_POST['newlevel']', userStatus='$_POST['newstatus']' WHERE userId='$_POST['id']'"; //this is line 9
mysql_query($sql, $con);
}
?>
感谢您的帮助,如果需要,请向我询问更多信息。
最佳答案
<?php
include('connectdb.php');
if (isset($_POST['update'])) {
$sql ="UPDATE tbluser SETuserNm='".$_POST['newname']."', userFullNm='".$_POST['newfullname']."', userEmai l='".$_POST['newemail']."'...";
//... Represents the rest of the query
mysql_query($sql, $con); }
?>
以类似的方式使用引号。