Jump to content

list question


lJesterl

Recommended Posts

im trying to do something and i cant figure out how to get it to list properly. Basicly I have 2 tables one called groups with 2 rows gid and gname and one called people with 3 rows pid, pname, and groupon

 

by doing this

 



$listgroups=mysql_query("SELECT gid,gname FROM groups ORDER by gname");
while(list($gid,$gname)=mysql_fetch_row($listgroups)){

$grouplist=$grouplist."
$gname
";
}

echo " $grouplist ";


 

I can get it to list like this:

 

 

[ Group A ]

 

[ Group B ]

 

 

I need to go even farther and have it get the names of the pname from people with the groupon being that group id. Let say John Doe Belongs to group A and group a's id is 1 and johndoe has groupon 1 in mysql. How would I also list everyone that has groupon to the coresponding group like so:

 

[ Group A ]

John Doe

James

Kyle

etc.

 

[ Group B ]

Sam

Bill

Ted

etc.

Link to comment
https://forums.phpfreaks.com/topic/57519-list-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.