"Whats wrong with delimited strings in dbases?"
Q: Why is the string delimited?
A: because you want to get three seperate pieces of information from it.
Q: What does a database do?
A: Give you seperate pieces of information.
See my point? :-) When you use a delimited string, you are just combineing three database columns into one, which doesn't make much sense, because you cannot order by any of the combined data, and selecting rows where the combined data has 'foo' in the second field is too complex to think about.
It is mucc better to split the delimited data into their own columns.
"To do it like that there would have to be a 'blockname_column' and 'blockname_position' for each block and that seems a bit cumbersome"
That would be cumbersome, and that's why they thought of normalization.
Instead of having one table that tries to contain everything, create two tables.
One to contain the user data,
and one to contain block data:
users:
id,name,whateverelseyouneed
blocks:
id,userid,blockname,position,state,color,column,whatever
Now you'd create a new recod in the blocks table for every block that the user can use. Ten blocks per user=>ten records in the blocks table per user.
Then you can get all blocks for the left column like this:
SELECT * FROM blocks WHERE userid=$userid AND column=1 ORDER BY position;
and for the second column:
SELECT * FROM blocks WHERE userid=$userid AND column=2 ORDER BY position;
Get all collapsed blocks for the first column:
SELECT *
FROM blocks
WHERE userid=$userid
AND column=2
AND state='collapsed'
ORDER BY position;