Echo function stopping
| From: | Shannon Doyle | Date: | Mon, 02 Apr 2001 11:52:41 +0000 |
| Subject: | Echo function stopping | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-8134@lists.php.net to get a copy of this message | ||
Hi People,
Below I have included some code that just doesn't seem to be functioning all
correctly. I have this running and it appears to stop the query/echo after
the first entry in the database. What is it that I am doing wrong here??
Regards,
Shannon
<?
$roundnum = "";
$sql = "select * from results order by round";
$dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
$results = mysql_db_query($db,$sql,$dbh);
for($i = 0; $i < mysql_num_rows($results); $i++) {
$array[$i] = mysql_fetch_array($results);
}
mysql_close($dbh);
for ($i = 0; $i < count($array); $i++) {
if ($array[$i]["round"] != $roundnum) {
$roundnum = $array[$i]["round"];
echo "<tr><td colspan='5'><br><p
align='center'><b><font
color='#990000'>Round
".$roundnum."</font></b></p></td></tr>";
echo "<tr><td
width='100'><p>".$array[$i]["home"]."</p></td><td
width='10'><p>".$array[$i]["home_goals"]."</p></td><td
width='50'>\n";
if ($array[$i]["home_goals"] > $array[$i]["away_goals"]) {
echo "<p>Defeated</p></td>";
}
elseif ($array[$i]["home_goals"] < $array[$i]["away_goals"]) {
echo "<p>Defeated by</p></td>";
}
elseif ($array[$i]["home_goals"] == $array[$i]["away_goals"]) {
echo "<p>Drew</p></td>";
}
echo "<td
width='100'><p>".$array[$i]["away"]."</p></td><td
width='10'><p>".$array[$i]["away_goals"]."</p></td>\n";
}
}
?>