Reputation: 154
I have an update function in my website, when I run my update.php the error comes up.
(This is the error)
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
(Here is my 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);
}
?>
Thank you for help, do ask me for more information if needed.
Upvotes: 0
Views: 76
Reputation: 659
Change all '$_POST['value']'
to "$_POST['value']"
because it does not understand the value in ''
.
Upvotes: 0
Reputation: 616
<?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); }
?>
Use the quotes in the similar way.
Upvotes: 1