PDA

View Full Version : MySQL: Sets and Such


Adrian Schneider
03-02-2005, 05:56 PM
I know you can use sets to store a set of data, but I was told using a regular text field would work better, because you get more than 64 members.

That being said, I have a few questions based on it.

Is it possible to expand a long list of numbers like 1,4,5,2,3,4,2,4234,2342,34234,262,62 into seperate numbers :

1
4
5
2
3
4
2 (just be able to differentiate them)
then run a query for each one (1 query, preferably), so each one would represent something like a userid.

Another problem I'm thinking will come up, will be table structure.

Each 'player' (table for players) will need to have 3 different 'scores' for each 'game'. (table for games) How would I set this kind of table relationship up?

Thanks.

sabret00the
03-02-2005, 06:03 PM
i take it each of these "1,4,5,2,3,4,2,4234,2342,34234,262,62" is a playerid?

you could then use a seperate table

playerid | score1 | score2 | score3

and yes you can run a loop on an array

and in order to get em onto a new line you'll need to explode them :)

highlighted words can be investigated better over at php.net :)

if you don't understand from php.net come back and i'll try and explain better :)

Adrian Schneider
03-02-2005, 06:10 PM
Thanks, I guess it was simpler than I thought, I seem to overcomplicate things in my head. :P