各行の結果を取得して一度に 1 つずつ出力して、最終的に独自の特定の変数に配置できるようにしようとしていますが、機能していません。誰かが私が間違っていることを見ることができますか? 最初の行を印刷する無限ループに入ります。合計4行あることがわかります。
$scores_query = mysql_query("SELECT Day, Time, AM_PM,
Away,
case when Away_Score is null then '@' else Away_Score end as Away_Score,
Home,
case when Home_Score is null then '' else Home_Score end as Home_Score
FROM `NFL_Games` WHERE Week=6
order by
(case Day
when 'Thu' then 1
when 'Sat' then 2
when 'Sun' then 3
when 'Mon' then 4
else 5 end),
Day, Time ASC");
$count = mysql_num_rows($scores_query);
echo "Hellloooo" . $count;
while($results = mysql_fetch_array($scores_query)) {
for($x = 1; $x <= $count; $x++) {
/*echo $results['Day'] . "__" . $results['Time'] . "__" . $results['AM_PM'] . "__" . $results['Away'] . "__" . $results['Away_Score'] . "__" . $results['Home'] . "__" . $results['Home_Score'];
echo "<br/>";*/
/*echo (Day, Time, AM_PM, Away, Away_Score, Home, Home_Score);*/
if ($x = 1) {
echo $results['Day'] . "__" . $results['Time'] . "__" . $results['AM_PM'] . "__" . $results['Away'] . "__" . $results['Away_Score'] . "__" . $results['Home'] . "__" . $results['Home_Score'];
echo "<br/>";
} else if ($x = 2) {
echo $results['Day'] . "__" . $results['Time'] . "__" . $results['AM_PM'] . "__" . $results['Away'] . "__" . $results['Away_Score'] . "__" . $results['Home'] . "__" . $results['Home_Score'];
echo "<br/>";
} else if ($x = 3) {
echo $results['Day'] . "__" . $results['Time'] . "__" . $results['AM_PM'] . "__" . $results['Away'] . "__" . $results['Away_Score'] . "__" . $results['Home'] . "__" . $results['Home_Score'];
echo "<br/>";
} else if ($x = 4) {
echo $results['Day'] . "__" . $results['Time'] . "__" . $results['AM_PM'] . "__" . $results['Away'] . "__" . $results['Away_Score'] . "__" . $results['Home'] . "__" . $results['Home_Score'];
echo "<br/>";
} else {
break;
}
}
}