I have an sql update query like this; please note that I just have a string of the query like $query:
$query = 'UPDATE "public"."activity" SET "itemid" = 2, "itemname" = 'sssd' WHERE "id" = 19';
From this stringified query, I can get the set clause separately as:
$setClause = '"itemid" = 2, "itemname" = 'sssd'';
I need to convert this set clause to a json array to send in an ajax request like:
{
"itemid": 2,
"itemname": "sssd"
}
So far I havent been able to figure this out; I looked online for a solution as well but couldn't find one. Any ideas please?