Taffd Posted April 9, 2008 Share Posted April 9, 2008 Hi folks, I have a table 'names' with one column 'name'. It has 10,000 names in it. I'd like to separate these 10,000 names into groups of 3 names and 1 remaining name, that is 3,333 groups of 3 with 1 leftover. I'd at first thought this would be simple to accomplish but alas not only can I not do it, I've had no luck at any other forum. Does anybody have any ideas please. Regards Taffd Quote Link to comment https://forums.phpfreaks.com/topic/100300-bet-you-cant-solve-this-one/ Share on other sites More sharing options...
Kieran Menor Posted April 9, 2008 Share Posted April 9, 2008 Seperate how? When listing them? Quote Link to comment https://forums.phpfreaks.com/topic/100300-bet-you-cant-solve-this-one/#findComment-512874 Share on other sites More sharing options...
Taffd Posted April 9, 2008 Author Share Posted April 9, 2008 In detail then - I'm trying to set up a new system for electing leaders. The electorate are divided into groups of 3. Each group then elects 1 of the 3 to represent them at the next level. Thus from 10,000 names, I want 3,333 groups of 3 names and 1 remaining name who will advance automatically to the next level. The second level will thus have 3,334 names. Again, I will want to organise them into 1,111 groups of 3 and have 1 remaining. I'll continue the process until I arrive at the required number of leaders, somewhere between 14 and 100. At the final level, I'll adjust the numbers in the groups so there's no remainder. There are no time constraints for this process, it's a back-end operation that will happen once a year. The whole exercise is a personal project that a friend and I are working on, an idealised community, with a web-based governance. Quote Link to comment https://forums.phpfreaks.com/topic/100300-bet-you-cant-solve-this-one/#findComment-512882 Share on other sites More sharing options...
laffin Posted April 9, 2008 Share Posted April 9, 2008 make 2 tables the main table sumfin like TABLE id integer name varchar group integer and a groups table, sumfin like TABLE id integer lvl integer max integer now u can assign how many ppl shud go into a group with some php coding. it's not as u make it out, where u divide all the names into seperate dbs but u add more info to the db so u can seperate different records. Quote Link to comment https://forums.phpfreaks.com/topic/100300-bet-you-cant-solve-this-one/#findComment-512890 Share on other sites More sharing options...
Taffd Posted April 9, 2008 Author Share Posted April 9, 2008 OK, Supposing I had a table:- groupID, name1, name2, name3 How do I go about taking 3 people from the names table, insert them into the above group table and then repeat the process, taking 3 different names etc. and so on until there is only one remaining name. Quote Link to comment https://forums.phpfreaks.com/topic/100300-bet-you-cant-solve-this-one/#findComment-512901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.