XF 2.2 json or serialize


Well-known member
I want to save an array.

seralize does

json_encode does

When i want to save the longer version, please?

The only thing i could miss in the json could be to add a comma at the begin and end, if i want to do a search on this field.

Now i can do "where field like %x,%

without the two "," you need to ask where field like x,% or %,x,% or %,x
You can also use json colum in the xenforo if you are using mysql version.greater then 5.7.8 which xf supports too and you can always apply mysql json search methods too on it if you want.
You shouldn't execute MySQL queries on either json or serialized fields either way. They're for storage, not querying. If you're storing an unordered list of integers and need to query a specific value, store them as comma separated list and use FIND_IN_SET, or store them in a relational table to map the 1:N relation so you can run well-indexed queries if you require complex or frequent queries on the table.
Top Bottom