Reputation: 1315
I know and understand why you shouldn't do that. I am sorry but there is no other way in this situation. However the database is not meant to stay there forever anyway (the content gets deleted after every hour).
What is the best way I could store multiple values in one field? How can I retrieve those values?
The values are like this:
SomeID -> Time, SomeID -> Time.... so I guess an array would be a solution?
Upvotes: 0
Views: 1115
Reputation: 385
If you do not need to search for values within that field, I suggest you go about using PHP serialize
/unserialize
or json_encode
/decode
.
This will allow you to place an array structure into a mysql field, and then later grab that data and deserialize/decode it. There is much debate as to which is better. Both have their pros and cons. I personally prefer json because I can use it in jQuery should the opportunity arise, and it is easier to read.
Upvotes: 3