I am using a php / mysql combination to display a list of teams from around the globe. I can sort into country order no problem and county / state, but what I would like to do is display a group of all the teams in the same state together and put the teams in alphabetical order like thus
Alabama
first team name
second team name
third team name
Ohio
first team name
second team name
etc etc
my code is as follows so far, any suggestions appreciated
$result = mysql_query("SELECT * from teams_online where country ='United States' order by county, team_name", $db);
echo "<table width=600 border=0>\n";
while ($myrow = mysql_fetch_array($result)){
printf("<tr><td width=50><td align=left><a href=\"%s\" onMouseOver=\"MM_showHideLayers('%s','','show')\" onMouseOut=\"MM_showHideLayers('%s','','hide')\">%s</a>, <i>%s</i><span id=\"%s\" style=\"position:absolute; width:400px; z-index:1; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 2px #FF0000; visibility: hidden\"><font size=2 color=#FF0000>%s</font> </span></td></tr>\n",$myrow["website_url"], $myrow["team_name"], $myrow["team_name"], $myrow["team_name"], $myrow["county"], $myrow["team_name"],$myrow["description"]);
}
echo "</table>\n";
Alabama
first team name
second team name
third team name
Ohio
first team name
second team name
etc etc
my code is as follows so far, any suggestions appreciated
$result = mysql_query("SELECT * from teams_online where country ='United States' order by county, team_name", $db);
echo "<table width=600 border=0>\n";
while ($myrow = mysql_fetch_array($result)){
printf("<tr><td width=50><td align=left><a href=\"%s\" onMouseOver=\"MM_showHideLayers('%s','','show')\" onMouseOut=\"MM_showHideLayers('%s','','hide')\">%s</a>, <i>%s</i><span id=\"%s\" style=\"position:absolute; width:400px; z-index:1; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 2px #FF0000; visibility: hidden\"><font size=2 color=#FF0000>%s</font> </span></td></tr>\n",$myrow["website_url"], $myrow["team_name"], $myrow["team_name"], $myrow["team_name"], $myrow["county"], $myrow["team_name"],$myrow["description"]);
}
echo "</table>\n";