i have this JSON string, which i want to insert into table. Here is my insert query:
$insert_sql = 'INSERT INTO yun_postmeta (post_id, meta_key, meta_value)
VALUES (5054, "_wc_free_gift_coupon_free_shipping", "a:1:{i:6;a:3:{s:10:"product_id";i:6;s:12:"variation_id";i:0;s:8:"quantity";i:1;}}");';
Of course, the query breaks because of the quotes ("). When i add backslash () in front of them, to escape, the query works and string gets inserted into the table, but for some reason my system doesn't work properly.
However, if i copy the JSON string and insert it manually into table, using phpmyadmin, system works normally.
Any idea what could be the problem here?
This sounds like encoding problem, but i don't have a clue what to do to solve it.
Thank you!