Smarty PHP
Code: Select all
while ($rows = pg_fetch_assoc($sql)){
$row[] = $rows;
}
$smarty->assign('row',$row);
$max = 0;
for($i=0; $i<count($row); $i++){
$row[$i]['previousrank'] = $row[$i-1]['position'];
$row[$i]['nextrank'] = $row[$i+1]['position'];
if(!isset($min) || (isset($min) && $row[$i]['position'] < $min)){
$min = $row[$i]['position'];
}
if($row[$i]['position'] > $max){
$max = $row[$i]['position'];
}
}
$smarty->assign('min', $min);
$smarty->assign('max', $max);
how do I get that peice of code to work within a while statement?
Non-Smarty PHP
Code: Select all
while ($row = pg_fetch_assoc($sql)){
//rows, and database data loaded...
//the For statement posted above, needs to work inside this while...
}