Jump to content

Issues with an unexpected '='


dzhax
 Share

Recommended Posts

I am working on CMS and need to create a query depending on the data sent to the page.Parse error: syntax error, unexpected '=' in lib/admin/dataUpdater.php on line 22

$query = "UPDATE global_settings SET ';foreach($vars as $eachValue){	$parsedValue = explode('=',$eachValue);	$query += $parsedValue[0] . "='" . $parsedValue[1] . "', ";}$query += "WHERE id=0";

Line 22: $query += $parsedValue[0] . "='" . $parsedValue[1] . "', ";I have even tried:

$query += $parsedValue[0] . "\='" . $parsedValue[1] . "', ";

and i getWarning: Unexpected character in input: '\' (ASCII=92) state=1 in lib/admin/dataUpdater.php on line 22Parse error: syntax error, unexpected '=' in lib/admin/dataUpdater.php on line 22Any idea because im stumped :)

Edited by dzhax
Link to comment
Share on other sites

$query = "UPDATE global_settings SET ';
you missed a quote here..single and double quote missed match.i think you want to concatenate strings instead of adding it. you need to use '.=' instead of '+='
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...