incrementing in php
- by Michael Stevens
I have a function that works on other pages but on this particular page its not working 100%
the piece of code that is failing to work is:
$query = "SELECT
*
FROM
rank_punting
JOIN
rank_player
ON
rank_player.full_name=rank_punting.name
WHERE
active='1'
AND
class='$class'
ORDER BY ABS(`rank_punting`.`rank_final`) ASC";
$rank = 0; $lastpct = 0;
$db->setQuery($query);
$result = $db->query();
if(mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if ($row['rank_final'] > $lastpct) {
$rank++;
$lastpct = $row['rank_final'];
}
$name = $row['name'];
$s1= $row['s1'];
$s2= $row['s2'];
$s3= $row['s3'];
$s4= $row['s4'];
$s5= $row['s5'];
$s6= $row['s6'];
$s7= $row['s7'];
$s8= $row['s8'];
$s9= $row['s9'];
$c1= $row['c1'];
$c2= $row['c2'];
$c3= $row['c3'];
$c4= $row['c4'];
$c5= $row['c5'];
$c6= $row['c6'];
$v1= $row['v1'];
$v2= $row['v2'];
$comp= $row['comp_rank_final'];
$season= $row['season_rank_final'];
$final=$row['rank_final'];
$link = "website_url";
$link2 = "<a href=\"http://{$link}\" target='_blank'>{$name}<br>Profile Page</a>";
if ($link = ''){$link2 = "<a href='index.php?option=com_ranking&view=playerprofile&player={$name}' >{$name}<br>Profile Page</a>";}
echo '<tr>';
echo " <th scope'row'>{$link2} {$lastpct} </th>";
echo "<td>"; echo 'DEBUG: '; echo $row['rank_final']; echo $lastpct;echo "{$rank}</td>";
echo "<td> Competition</td>";
echo "<td> {$comp}</td>";
echo "<td> {$c1}</td>";
echo "<td> {$c2}</td>";
echo "<td> {$c3}</td>";
echo "<td> {$c4}</td>";
echo "<td> {$c5}</td>";
echo "<td> {$c6}</td>";
echo "<td> {$c7}</td>";
echo "<td> {$c8}</td>";
echo "<td> {$v2}</td>";
echo "</tr>";
echo '<tr>';
echo "<th scope'row'> </th>"; echo "<td> </td>";
echo "<td> Game Film</td>";
echo "<td> {$season}</td>";
echo "<td> {$s1}</td>";
echo "<td> {$s2}</td>";
echo "<td> {$s3}</td>";
echo "<td> {$s4}</td>";
echo "<td> {$s5}</td>";
echo "<td> {$s7}</td>";
echo "<td> {$s8}</td>";
echo "<td> {$s6}</td>";
echo "<td> {$v1}</td>";
echo "</tr>";
}
}
//----------------
echo '</tbody>
</table>';
}