If you want to store the content of arrays in your database, I suggest
you have another look at your current approach. I think you are heading
the wrong direction.
You haven't stated exactly what you are trying to achieve, but I think
you don't want to implode an array and store that as a string.
While it is possible, it will be harder for you to later retrieve the
info, or join it to another table, or group it, etc.
Actually all regular database actions I can think of would benefit from
the normal approach, which I describe below:
Imagine a table that stores answers that people gave you for your online
poll.
You ask 3 questions:
q1) Rate my site's layout (1=poor, 2,3,4, 5=great)
q2) Rate my site's content (1=poor, 2,3,4, 5=great)
q3) Rate my site's structure (1=poor, 2,3,4, 5=great)
BAD STORAGE:
You can create a table like this:
CREATE TABLE tblPollAnswers(
visitorid integer PRIMARY KEY,
impl_answers TEXT
)
The visitorid is just some imaginary unique number. It isn't important
for the example.
Now, if you implode the answers to the questions, you end up with
content that might look like this:
SELECT visitorid, impl_answers from tblPollAnswers;
visitorid impl_answers
22 "2,4,1"
24 "1,2,3"
44 "5,3,3"
443 "1,1,1"
598 "1,4,3"
etc.
Now try to figure out what the average rating for q1, q2 or q3 is.
You'll have to rip apart the string in impl_answers, make an integer of
it again, sum them, etc.
It is messy and errorprone.
GOOD STORAGE:
CREATE TABLE tblPollAnswers(
visitorid integer PRIMARY KEY,
questionid integer,
answer integer
)
SELECT visitorid, questionid, answer from tblPollAnswers;
visitorid questionid answer
22 1 2
22 2 4
22 3 1
24 1 1
24 2 2
24 2 3
44 1 5
44 2 3
44 3 3
etc.
Now you can easily access, group, etc all data.
eg:
Select questionid, AVG(answer) FROM tblPollAnswers GROUP BY questionid;
While the second approach might look more complicated on first
inspection, it is much much easier in the long run.
I would also advise to get a good book on the basics of databases and
how to design them. The basics are not rocket-science at all.
I hope this helped.
Good luck