Thank you for wanting to try and tackle this in PHP/MySQL.  I will include 
the code that I have and also the sql for the tables.

CREATE TABLE b863765470 (
team_id int(10) default NULL,
  name varchar(30) default NULL,
  sea_id int(10) default NULL,
  w int(10) default '0',
  l int(10) default '0',
  t int(10) default '0',
  f int(10) default '0',
  s int(10) default '0',
  pts int(10) default '0',
  score_for int(10) default '0',
  score_against int(10) default '0',
  score_differential int(10) default '0',
  max_pt int(10) default '0',
  UNIQUE KEY team_id(team_id) ) TYPE=MyISAM;

INSERT INTO b863765470 VALUES (37, 'BV Stars Gold I', 1, 3, 4, 2, 0, 0, 24, 
41, 52, -11, 0);
INSERT INTO b863765470 VALUES (38, 'BV Stars Gold II', 1, 3, 4, 2, 0, 0, 
24, 39, 48, -9, 0);
INSERT INTO b863765470 VALUES (39, 'KC Legends White I', 1, 5, 4, 0, 0, 0, 
30, 43, 41, 2, 0);
INSERT INTO b863765470 VALUES (40, 'KC Legends White II', 1, 2, 5, 2, 1, 0, 
18, 43, 48, -5, 0);
INSERT INTO b863765470 VALUES (41, 'OSC Spirit Gold', 1, 6, 2, 1, 0, 0, 39, 
59, 35, 24, 0);
INSERT INTO b863765470 VALUES (42, 'OSC Spirit White', 1, 4, 4, 1, 0, 0, 
27, 51, 51, 0, 0);


Here is my Select statment
Select * from $temp2 where sea_id = '$sea_id' order by pts DESC,
score_for DESC, score_against DESC, score_differential DESC, max_pt DESC, 
name ASC

<table border=1>
<th>Rank</th><th>W</th><th>L</th><th>T</th><th>F</th><th>Team</th><th>Pts</th><th>SF</th><th>SA</th><th>SD</th>

         $i=1;
         while (($row = mysql_fetch_object($result))){
         echo "</td></tr><tr><td>$i</td>
                         <td>$row->w</td>
                         <td>$row->l</td>
                         <td>$row->t</td>
                         <td>$row->f</td>
                         <td>$row->name</td>
                         <td>$row->pts</td>
                         <td>$row->score_for
                         </td><td>$row->score_against</td>
                         <td>$row->score_differential";
         $i++;
</td></tr></table>


Problem is, if they decide that HTH (Head to Head which is that if they are 
tied up to this point, than I have to check to see if they have played each 
other and if they have, who won) is more important than score_for or any of 
the other orderings, than it has to do the loop to see if they have played 
each other.  I hope that makes since.  I could write out all the criteria 
if you need, but I am hoping that this will be enough.

Thanks
Steve




At 04:08 PM 4/25/2002, you wrote:

>On Thursday, April 25, 2002, at 04:54  PM, Steve Buehler wrote:
>
>>I am using PHP to access a mysql database.  I was told that what I need
>>to do needs to be done in PHP and not mysql.  I can get mysql to order
>>things like this:
>>Select * from $temp2 where sea_id = '$sea_id' order by pts DESC
>>The problem is that if there is a tie (as in ranking 4 and 5 below), I
>>need to run another query to check to see if something else has happened and
>>if it happened, than that team would be a higher rank than the other.
>>It
>>is possible to have more than 2 teams tieing too.  So I have to be able 
>>to determine what order the teams should be in.
>
>I would like to try to tackle this -- can you give me a dump of this table 
>that I can work with?  No guarantees, though.
>
>
>Erik
>
>
>
>
>----
>
>Erik Price
>Web Developer Temp
>Media Lab, H.H. Brown
>[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to