0

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.

2

2 Answers 2

1
<?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.

Sign up to request clarification or add additional context in comments.

Comments

0

Change all '$_POST['value']' to "$_POST['value']" because it does not understand the value in ''.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.