I use GROUP_CONCAT to group together a set of names that all match another field the trouble is if I want to view it by an individual person it won't group the names together and will only have the name of the person's id that I match it to in the database.
Is there anyway to get around this so that the GROUP_CONCAT will work in this way?
As an example if I'm viewing all items in category A it'll group them together perfectly and output
catID: 1
catName: foobar
People: Joe Bloggs,John Doe
but if I then try to look at it through Joe Blogg's profile linking it to his id in the database (WHERE id = $_GET[pid]) it'll output
catID: 1
catName: foobar
People: Joe Bloggs
I don't want this because I want it to group together all people that match a certain criteria no just everyone in a specific category.
I don't want to have to have a for loop in the PHP code going through every result in the table trying to match the id because eventually this table will be very big - in the 10s of thousands I'd imagine - so would create more work for the server every time someone goes into a specific person's page.
If anyone can help with a way to do it I'd be very grateful.
The output fields works out as
CatID, SubCatID, PersonID, People
The SubCatID is what links people together within a parent category.
If there's anything else that doesn't make sense let me know.