Re: Some assistance please

From: Date: Wed, 04 Apr 2001 00:31:47 +0000
Subject: Re: Some assistance please
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8199@lists.php.net to get a copy of this message
Shannon, Try changing your last 'elseif' to an 'else'. It could be hanging on the else-if syntax. Rich ----- Original Message ----- From: "Shannon Doyle" <shannon@bigblue.net.au> To: <php-db@lists.php.net> Sent: Tuesday, April 03, 2001 6:27 AM Subject: [PHP-DB] Some assistance please > Hi People, > > I have a sql query running an array'd result that should echo a different > result depending on the result of the query. However, it successfully does > one of the entries from the query, but then appears to stop. With no further > results displayed. Could someone take a look at the code at the bottom of > this email and see if they can determine why it is not continuing through > the rest of the results. > > Thanks in advance > > - 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"; > } > } > ?> > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#8199) next »