Jump to content


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


Displaying Results

Recommended Posts

I have four columns: score_gross1, score_gross2, score_gross3, score_gross4

I have a select statement:

[code]SELECT * FROM pt_stats WHERE tourn_id='$tourn_id' AND score_wd = '0' AND score_dq = '0' ORDER BY `score_gross1` ASC LIMIT 0,1 [/code]

I would like to display the order from day to day by adding the columns together, not just by one column. Something like below.

[code]$er_roundttl = $score_gross1 + $score_gross2 + $score_gross3 + $score_gross4;[/code]

Is there anyway to work this into the SELECT statement? Is there any other way to do this.

Below is the code I use to display the results.

[code]while ( $rowpl= mysql_fetch_array($resultpl)){extract($rowpl);
        $row_color = ($row_count % 2) ? $color1 : $color2;
        /*$er_roundttl = $score_gross1 + $score_gross2 + $score_gross3 + $score_gross4;*/
        $place = $row_count + 1;
        echo "<tr class='$row_color'>\n";
        echo "<td align='center'>$place</td>\n";
        echo "<td width='30%'><a href='../statistics/playerstats.php?player_id=$player_id'>$pt_player_name</a></td>\n";
        echo "<td>$score_gross1</td>\n";
        echo "<td>$score_gross2</td>\n";
        echo "<td>$score_gross3</td>\n";
        echo "<td>$score_gross4</td>\n";
        echo "<td>$er_roundttl</td>\n";
        echo "<td>$$score_money.00</td>\n";
        echo "<td>$score_tpoints</td>\n";
        echo "</tr>\n";

Share this post

Link to post
Share on other sites
This will calc totals and output highest totals first

[code]SELECT *, (score_gross1 + score_gross2 + score_gross3 + score_gross4) AS roundTotal
FROM pt_stats
WHERE tourn_id='$tourn_id'
    AND score_wd = '0'
    AND score_dq = '0'
ORDER BY roundTotal DESC[/code]

Share this post

Link to post
Share on other sites


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.