having trouble getting the following code to output a particular stat… i have progressed to where i am no longer crashing the server with an endless loop, however still not getting desired output.
I am attempting to create an automatically updating Games Behind stat for my baseball gaming league. The code already outputs the league into a table that is split by division…
what i need to do is to be able to take the win/loss record of the division leader, and use it in a formula for the rest of the division…
[php] <?php
include(“inc/connection.php”);
$division =array(“Western Division”, “Mid-West Division”, “South-East Division”, “North-East Division”) ;
for($i=1;$i<5;$i++){
$stmt= $conn-> prepare(‘SELECT * FROM ddl WHERE division=? ORDER BY wins DESC, pct DESC’);
$stmt->execute(array($i));
$rs=$stmt-> fetchAll();
echo ‘
$v=1;
$taw=1;
$tal=1;
foreach($rs as $row) {
echo “
echo ‘
echo ‘
//this is where i am trying to create GB stat
if($GLOBALS[‘v’] =1){
$GLOBALS[‘taw’] =$row[‘wins’];
$GLOBAL[‘tal’] =$row[‘loss’];
echo ’
} else{
echo ‘
}
//echo ‘
echo ‘
echo ‘
echo “
$GLOBALS[‘v’] ++;
}
}
?>[/php]
Here is current code… outputs GB as -
Any help greatly appreciated
N.B link to page http://mlbjunkies.com/DD/index.php