Skip to main content
added 164 characters in body
Source Link

Okay so what you have there is a JSON_ARRAY() to check if a particular id exists in the JSON_ARRAY() simply put a condition i.e. JSON_CONTAINS(config_value,"1")=1, so if "1" is present in the your JSON_ARRAY() then it will return 1 else 0.

Also, rather than doing json_encode in PHP code while doing the insert/update query you could use "..config_value=JSON_ARRAY(" . implode(',', $arr) . ") ...

Okay so what you have there is a JSON_ARRAY() to check if a particular id exists in the JSON_ARRAY() simply put a condition i.e. JSON_CONTAINS(config_value,"1")=1, so if "1" is present in the your JSON_ARRAY() then it will return 1 else 0.

Okay so what you have there is a JSON_ARRAY() to check if a particular id exists in the JSON_ARRAY() simply put a condition i.e. JSON_CONTAINS(config_value,"1")=1, so if "1" is present in the your JSON_ARRAY() then it will return 1 else 0.

Also, rather than doing json_encode in PHP code while doing the insert/update query you could use "..config_value=JSON_ARRAY(" . implode(',', $arr) . ") ...

Source Link

Okay so what you have there is a JSON_ARRAY() to check if a particular id exists in the JSON_ARRAY() simply put a condition i.e. JSON_CONTAINS(config_value,"1")=1, so if "1" is present in the your JSON_ARRAY() then it will return 1 else 0.