0

I have a form in which I am taking user data and saving it in JSON format. On starting I forgot to check for double quotes now I am getting issue on json_decode while taking data back for db. For example my data is like

{"key1"=>"this is a sample" code","key2"=>"this is a sample code""}

I tried below:

SELECT `name` FROM `table` WHERE `name` LIKE '%"%';

But it gives me all data but I need only data which has double quotes in between.

halfer
  • 19,824
  • 17
  • 99
  • 186
Passionate Coder
  • 7,154
  • 2
  • 19
  • 44
  • Does `key1` and `key2` are always the same? – Syscall Feb 23 '18 at 13:50
  • This is a duplicate of a question [and the answer is here](https://stackoverflow.com/a/8633757/5517065). The short answer is that you need to escape the quote twice: `SELECT name FROM table WHERE name LIKE '%\\"%'` – mtr.web Feb 23 '18 at 13:50
  • Your query should work. Have you verified that the other names do not have double quotes in them? – aynber Feb 23 '18 at 13:57

0 Answers0