我有一個聚合物(1.0)應用程序,我試圖創建(基於拉伸教程聯賽表),我不能找出路由如果使用MVC,所以我選擇了一個頁面的網站,引用不同的PHP文件。我怎樣才能停止一個PHP而循環重複一遍又一遍?
我在MySQL的一個表,我試圖納入表,使用簡單的回聲表腳本,但這種重演數百次。我怎樣才能停止這個循環?
$result = mysql_query('select * from results',$connection) or die('cannot show tables');
while($tableName = mysql_fetch_row($result)) {
$sql = ('SELECT `home_team_name`,`away_team_name`,`home_goals_for`, `away_goals_for`, DATE_FORMAT(`fixture_date`, "%e %M %Y"), TIME_FORMAT(`fixture_time`, "%h:%i %p") FROM `results` ORDER BY fixture_date desc LIMIT 20 '.$table) or die('cannot show columns from '.$table);
echo '<h3>',$table,'</h3>';
$result2 = mysql_query($sql);
if(mysql_num_rows($result2)) {
echo '<table cellpadding="4" cellspacing="0" class="table table-striped table-hover table-bordered">';
echo '<tr class="info"><th>Home team</th><th>Away Team</th><th>Score</th><th>Score</th><th>Date<th>Time</th></tr>';
while($row2 = mysql_fetch_row($result2)) {
echo '<tr>';
foreach($row2 as $key=>$value) {
echo '<td>',$value,'</td>';
}
echo '</tr>';
}
echo '</table><br />';
}
}
我添加了'< 50',但是這隻返回50個表頭行?
該網站是在直播的http://jay-o.uk/#!/results CSS和其他數據都還好現在,只要這個討厭的循環。
你選擇在第一循環中的所有結果,然後對每一個結果,你再選擇其他20.您還使用'$ tableName'在一個地方,但在另一個'$ table' 。 – rjdown