How do I code a loop for my echo statement?
- by ggg
I get only one printed result in the foreach echo loop at the bottom of the page.
<?php
defined('_JEXEC') or die('Restricted access');
$db =& JFactory::getDBO();
$query0 = "SELECT * FROM `jos_ginfo` WHERE . . . LIMIT 30";
//echo $query0;
$db->setQuery($query0);
$ginfo = $db->loadObjectList();
//echo
//$ginfo[0];
foreach($ginfo as $ginfo[$i]):
{$i=0; $i++;}
endforeach;
echo $db->getErrorMsg();
if(empty($ginfo)){
echo "<center>No
game found, try a different entry.</center>";
}else{
$pgndata = array ( $ginfo[$i]->Id);
$i=0;
foreach($pgndata as $ginfo[$i]->Id):
//I am only getting one printed result!
{
echo "<a href='/index.php?option=com_publishpgn&tactical-game=".$ginfo[$i]->Id."&Itemid=78.html'>\n";
echo "".$ginfo[$i]->White." v. ".$ginfo[$i]->Black." (".$ginfo[$i]->Result.") ".$ginfo[$i]->EventDate." ECO:".$ginfo[$i]->ECO."</a><br>\n";
$i++;
}
endforeach;
//echo "</div>";
}
?>