PHP - Multiple rows as string
Posted on 2009-05-06
Hopefully a simple one for you, my head is not in coding mode today!
I have designed a student tracking system which is working great and I would now like to assign each student to specific groups. Each student can be in one or multiple groups.
I have a 'groups' table which lists each individual group and its name. I have also created a 'group_assignments' table which lists the user ID along with the group ID.
As an example, student 31 is a member of 3 groups and as a reult has 3 rown in the group_assignments table. I can easily represent this data in a repeating table but how would I return the 3 rows as a comma seperated list? ie.
group1, group2, group3
Many thanks Experts.