Jump to content

GROUP BY?


karimali831

Recommended Posts

Hi all,

 

Visit my website at http://cupaddon.com/?site=platforms

as you can see there is "Console Platform" and two for "PC Platform".

 

I want to group these platforms together so that all ladders are shown in each platform instead of showing each platform for each ladder if that makes sense?

 

Here is the code:

 

if($show_inactive_platforms) $activity = '';
else $activity = "WHERE status='1'";

$getplatforms = safe_query("SELECT * FROM ".PREFIX."cup_platforms $activity ORDER BY ID DESC");
  echo '<table width="100%" bordercolor="'.$border.'">';
while($pl=mysql_fetch_array($getplatforms)) {

$getladders = safe_query("SELECT * FROM ".PREFIX."cup_ladders WHERE platID='$platID'");
$total_ladder_rows = mysql_num_rows($getladders);

$getmatches = safe_query("SELECT * FROM ".PREFIX."cup_standings WHERE platID='$platID'");
$played_matches = mysql_num_rows($getmatches);

eval ("\$one_head = \"".gettemplate("platforms_head")."\";");
echo $one_head;
eval ("\$one_head = \"".gettemplate("platforms_content")."\";");
echo $one_head;

}echo '</table>';

 

platforms_head.html template:

 

  <tr bgcolor="$bghead">
    <td colspan="5" height="20" align="center" class="title">$pl[platform]</td>
  </tr>

 

platforms_content.html template:

 

   <tr>
    <td width="25%" align="center" bgcolor="$bg1" rowspan="6">$logo</td>
    <td width="55%" bgcolor="$border">$pl[name]</td>
   </tr>
    <tr>
     <td bgcolor="$bg1">$pl[descrip]</td>
   </tr>
    <tr>
     <td bgcolor="$bg2">$total_ladder_rows Total Ladders</td>
   </tr>
    <tr>
     <td bgcolor="$bg1">$active_teams/$all_teams Active Teams</td>
   </tr>
    <tr>
     <td bgcolor="$bg1">$played_matches Played Matches</td>
   </tr>
    <tr>
     <td bgcolor="$bg2"><img src="images/cup/icons/go.png"> <a href="?site=ladders&platID=$platID">View Ladders</a></td>
   </tr>
    <tr>
     <td colspan="2"></td>
   </tr>

 

any help is appreciated,

thank you!

Link to comment
https://forums.phpfreaks.com/topic/209506-group-by/
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.