Hi everyone
Im new to php/mysql and teaching myself
anyway I'm trying to create a section and everything that belongs in that section then another section ,etc. to echo the section only once and the other querries under it.
example:
SECTION1
querry1 that belongs in section1
querry2 that belongs in section1
SECTION2
querry1 that belongs in section2
querry1 that belongs in section2
and will not echo a SECTION if no querries belongs to it.
$result = mysql_query
("SELECT ts_clubs.name
AS 'club',ts_clubs.id
AS club_id,
ts_game_sections.id,
ts_game_sections.name[COLOR=orange]//this would be echoed once[/color]
FROM ts_clubs,ts_game_sections
WHERE ts_clubs.user_id=phpbb_users.user_id
AND ts_clubs.club_section=ts_game_sections.id [COLOR=orange]//matches the section id[/COLOR]
ORDER BY ts_game_sections.name ASC") or die(mysql_error());
while($row=mysql_fetch_array($result))
{
echo"$row['name']
$row['club']";
}
mysql_free_result($result);
of course this will echo the SECTION again in every querry.
resulting in:
SECTION1
querry1 that belongs in section1
SECTION1
querry2 that belongs in section1
etc.
Any help will be greatly appreciated.
Thanks