sOnt sOnt - 1 year ago 85
MySQL Question

Syntax error in php code

I'm a bit confused about the syntax of php.

I am trying to do a query without success and I'm stucked here for 2 days.

$query = ('UPDATE cegek SET CegNev='."$cegnev".', Kozpont='."$kozpont".', Bevetel='."$bevetel".', Alkalmazottak='."$alkalmazott".', Iparag='."$iparag".' WHERE id='."$id");

This returns
Parse error: syntax error, unexpected '$cegnev' (T_VARIABLE) in

I tought that "" for variables and '' for string.

Anyone can help?

Answer Source

Should use concatenation operator ('.') between two strings

Try this

$query = ("UPDATE cegek SET CegNev='".$cegnev."', Kozpont='".$kozpont."', Bevetel='".$bevetel."', Alkalmazottak='".$alkalmazott."', Iparag='".$iparag."' WHERE id=".$id."");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download