I have a checkbox value which I store in a mySQL database serialized. However, I’m having a problem displaying the values when pulling them out. Here is my view script:
What do you mean by “a checkbox value which I store in a mySQL database serialized” ?
Could you post the code that inserts the record into the database. The problem your describing doesn’t make a whole lot of sense. At least not to me anyway.
Just a thought - why are you serialising an array to put into a field?
Heres an idea I want you to consider.
Have another table called ‘titles’.
That table has three columns - ID, RequestID and Title.
For every request, you can have multiple titles right? Hence serialising the array?
So how about having a row for each of those titles in the ‘titles’ table?
That way database functions would be so much more efficient and doable, for example:
//get all titles for request #20:
SELECT Title FROM Titles WHERE RequestID = 20
//get the first title for request with FirstName 'Dave'
SELECT Title FROM Titles INNER JOIN Requests ON Requests.ID = Titles.RequestID WHERE FirstName = 'Dave' LIMIT 1
There are other examples etc - but I just wanted to throw this at you to see what you think. Its a more structured way of approaching multiple values than serialising an array.