When i update data using php mysql, got some issue, my code php code are here
$query = "UPDATE `wp_experience` SET
`exp_from` ='". $exp_from."' ,
`exp_to` = '". $exp_to."' ,
`exp_title` = '". json_encode($exp_title)."',
`exp_desc` = '". json_encode($exp_desc)."' ,
`exp_cat` = '". $exp_cat."'
WHERE `id` =".$oldid;
it will produce data like,
UPDATE
wp_experienceSETexp_from='2016-01-22 00:00:00' ,exp_to= '2002-11-14 00:00:00' ,exp_title= '{"en":" PSA Peugeot Citroën Automobiles, Mulhouse (F-68)","fr":"Technical Directué - FRENCH","de":"Responsable d'unité de maintenance"}',exp_desc= '{"en":" Test</p>","fr":" Test</p>","de":" H</p>"}' ,exp_cat= '18' WHEREid=28
i got this issue,
1064 - 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 'unité de maintenance"}',
exp_desc= '{"en":" Test</p>","fr":" Test</p' at line 1
How to fix this issue??
Responsable d'unitéstring breaks your query. usemysqli_real_escape_string()as much as you can in order to avoid such problems.