title: mysql ignore \" on json insertion
body: <p>i have to store html content in the database as json along other data. when i get the certain html data in javascript, i wrap it to a object alongside other data and convert it to json string which apply escape &quot; which avoid any conflicts. when i pass the data by AJAX to php and insert it to MYSQL , in the database table there is no escape &quot; and so when i read data and try to deserialize , it makes an error because of invalid json (on both php and js)/</p>
  <p>when i convert to json by js i have something like</p>
  <pre><code>{&quot;cat&quot;:&quot;education-content&quot;,&quot;id&quot;:&quot;45a93325-2bab-4296-cc8d-92e7994dabe0&quot;,&quot;contents&quot;:&quot;&lt;p&gt;&lt;span style=\&quot;background-color: rgb(224, 62, 45);\&quot; data-mce-style=\&quot;background-color: #e03e2d;\&quot;&gt;شستنیتشنسذیت سشای تشس ایتنشسا تینشاسنتیاستشن ایتنشس ایتنش&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=\&quot;color: rgb(22, 145, 121);\&quot; data-mce-style=\&quot;color: #169179;\&quot;&gt;شتسنیاتشسایتنشساتینشساتیناشس یاشست نیاتنشس &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=\&quot;font-size: 14pt;\&quot; data-mce-style=\&quot;font-size: 14pt;\&quot;&gt;&lt;strong&gt;سشیتاشتنسیاش&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br data-mce-bogus=\&quot;1\&quot;&gt;&lt;/p&gt;&quot;}
  </code></pre>
  <p>but in database table it is stored as</p>
  <pre><code>{&quot;cat&quot;:&quot;education-content&quot;,&quot;id&quot;:&quot;45a93325-2bab-4296-cc8d-92e7994dabe0&quot;,&quot;contents&quot;:&quot;&lt;p&gt;&lt;span style=&quot;background-color: rgb(224, 62, 45);&quot; data-mce-style=&quot;background-color: #e03e2d;&quot;&gt;شستنیتشنسذیت سشای تشس ایتنشسا تینشاسنتیاستشن ایتنشس ایتنش&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(22, 145, 121);&quot; data-mce-style=&quot;color: #169179;&quot;&gt;شتسنیاتشسایتنشساتینشساتیناشس یاشست نیاتنشس &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt;&quot; data-mce-style=&quot;font-size: 14pt;&quot;&gt;&lt;strong&gt;سشیتاشتنسیاش&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br data-mce-bogus=&quot;1&quot;&gt;&lt;/p&gt;&quot;}
  </code></pre>
  <p>this json is generated by jquery as</p>
  <pre><code> var education_obj={
              cat : cat,
              id : id,
              contents : contents
  
          };
  
  
          var item_wrapp_json = JSON.stringify(education_obj);
  </code></pre>
  <p>which is passed by ajax. i checked the json in last moment of insertion in php which is okay.</p>
  <p>EDIT: php code that insert items.</p>
  <pre><code>$citems_query = &quot;INSERT INTO `course_items_tbl`(`CIID`, `CSFK`, `CFK`, `CIORDER`, `CIOPTIONS`) VALUES &quot;;
  
         
  
          foreach($data_obj[&quot;courseSections&quot;] as $item){
  
  
              $sectionID = $item[&quot;section_id&quot;];
              $sectionName = $item[&quot;section_name&quot;];
              $sectionType = $item[&quot;section_type&quot;];
  
  
  
              //$item[&quot;section_questions&quot;] this is the json string from js
              foreach($item[&quot;section_questions&quot;] as $qitem){
  
                  
  
                  $test = $qitem;
  
                  
                  
  
                  
                  $citems_query .= &quot;('&quot;.$qid.&quot;','&quot;.$sectionID.&quot;','&quot;.$course_id.&quot;', &quot;. $qorder .&quot; , '&quot;.$qitem.&quot;' ),&quot;;
                  
                  $qorder++;
              }
  </code></pre>