(using Coldfusion8/MySQL5.0.88)
I’m storing JSON strings in a database. Strings consist of an id (key) and a number of items in a list (values).
Values look like this:
LOCAL.dropRecall = {"994323":"596895,596871,596864,596888,596840abc,596833,596826","991234":"9999,8888,abced"}
My problem is trying to delete a key/value pair. I’m trying like this:
<cfif StructKeyExists(LOCAL.dropRecall,"#Session.id#")>
<cfdump output="e:\dump.txt" label="catch" var="detected">
<cfset StructDelete( LOCAL.dropRecall,"#Session.id#", "true")>
</cfif>
which correctly detects the key/value pair (detected is reported), but deleting it does not work.
Question:
What am I doing wrong? Why is the key/value pair not removed?
EDIT:
Ok. Found it. I queried the database for field items, set this to LOCAL.dropRecall and wrote items back into the database… so the structDelete worked, but I did not write the empty struct back to the database.
Check that the value of
session.idis what you think it is (no extra whitespace or anything like that). I tried a modification if your code on CF8, and it works fine for me:Does that code not work for you?