I have this query
$q1 = "UPDATE klanten SET (
kla_tel2,
kla_mobiel,
kla_fax,
kla_btw_nummer,
kla_bankrekening,
kla_ww,
kla_bez_straat,
kla_bez_nummer,
kla_bez_toev,
kla_bez_pc,
kla_bez_plaats,
kla_bez_land_id,
kla_post_straat,
kla_post_nummer,
kla_post_toev,
kla_post_postbus,
kla_post_pc,
kla_post_plaats,
kla_post_land_id,
kla_fac_straat,
kla_fac_nummer,
kla_fac_toev,
kla_fac_postbus
kla_fac_pc,
kla_fac_plaats,
kla_fac_land_id,
kla_sidn_owner,
kla_reg_status,
kla_rechtspersoon
)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
WHERE kla_id=" . $kla_id;
But when executed it gives me a syntax error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( kla_tel2, kla_mobiel, kla_fax, kla_btw_num' at line 1: SQL: UPDATE klanten SET ...
What I know is that all values are filled and that $kla_id
is filled too, but as this is a SQL Syntax error that shouldn't be a problem.
EDIT
MySql Client Version is 5.0.51a Server Version is 5.0.51a-24+lenny4 Protocol version is 10
You're using the wrong UPDATE
syntax. Please see the docs for more info.
The right syntax looks like:
UPDATE klanten SET kla_tel2 = <some_value>, kla_mobiel = <some_other_value> WHERE kla_id = <some_third_value>
You can also use this with prepared SQL statements like your example above, using question marks.