修復了我的主MySQL錯誤之後,我現在發現包含我創建的MySQL表的網站上的PHP存在問題。我收到的文字:涉及MySQL的Web(PHP)錯誤
Website link directly to error
警告:mysql_fetch_array()預計參數1是資源,布爾在在線/home/content/26/10406626/html/highscore/index.php給出258
這是我$結果文件中:
if ($skill == "Attack" || $skill == "Defence" || $skill == "Strength" || $skill == "Hitpoints" || $skill == "Range" || $skill == "Prayer" || $skill == "Magic" || $skill == "Cooking" || $skill == "Woodcutting" || $skill == "Fletching" || $skill == "Fishing" || $skill == "Firemaking" || $skill == "Crafting" || $skill == "Smithing" || $skill == "Mining" || $skill == "Herblore" || $skill == "Agility" || $skill == "Thieving" || $skill == "Slayer" || $skill == "Farming" || $skill == "Runecraft" || $skill == "Hunter" || $skill == "Construction" || $skill == "Summoning" || $skill == "Dungeoneering") {
mysql_select_db("scores", $con);
$result = mysql_query("SELECT * FROM skills WHERE ". $PLAYERS_TO_NOT_SHOW . " ORDER BY " . $skill . "lvl DESC, " . $skill . "xp DESC");
}
else {
$skill = "";
mysql_select_db("scores", $con);
$result = mysql_query("SELECT * FROM skillsoverall WHERE ". $PLAYERS_TO_NOT_SHOW . " ORDER BY lvl DESC, xp DESC");
}
釷是爲線254至278: 顯然,線258是*而($行= mysql_fetch_array($結果))*
<?php
$rank = 1;
while($row = mysql_fetch_array($result))
{
echo "<a name=\"" . $rank . "\"></a>";
echo "<a class=\"row\">";
echo "<span class=\"columnRank\">";
echo "<span>" . $rank . "</span>";
echo "</span>";
echo "<span class=\"columnName\">";
echo "<span>" . $row['playerName'] . "</span>";
echo "</span>";
echo "<span class=\"columnLevel\">";
echo "<span>" . $row[$skill . 'lvl'] . "</span>";
echo "</span>";
echo "<span class=\"columnXp\">";
echo "<span>" . $row[$skill . 'xp'] . "</span>";
echo "</span>";
echo "</a>";
$rank++;
}
mysql_close($con);
?>
你能還供應其中'$ result'設置的線路? – EWit
@EWit是的,我只是做到了。抱歉! – user2619426
什麼是$ PLAYERS_TO_NOT_SHOW?我認爲這是你的問題來自 – CodeBird