[Solved] sql/php syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting [closed]


You lost track of all needed ' and additionally forgot to quote username value. So instead of

$result = mysql_query("update Users set lat="$lat",lon='$lng' where username=$_SESSION['username']");

do this in more clean manner:

$result = mysql_query( "update Users set lat="$lat",lon='$lng' where username="" . $_SESSION["username'] . "'");

or even better:

$query = sprintf("update Users set lat="%s",lon='%s' where username=%s"), 
         $lat, $lng, $_SESSION['username']);
$result = mysql_query($query);

BTW: switch to MYSQLi or PDO as MYSQL extension is deprecated, no new code should touch it.

2

solved sql/php syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting [closed]