mysql_query($query,$con);
$query = "SELECT * FROM NW_WORLD;";
$result = mysql_query($query, $con);
$i = 0;
$counter = count($result);
while($result)
{
$village = mysql_result($result, $i, "village");
$player = mysql_result($result, $i, "player");
echo "village: $village ";
echo "player: $player<br>";
$i++;
}
我想打印從Select語句中獲得的所有數據。此代碼正在工作,但在表格結束後,我收到了一些錯誤的數據。使用While循環打印數據直到表結尾
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 6788 on MySQL result index 4 in C:\xampp\htdocs\debal\nw_check_exec.php on line 41
village: player:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 6789 on MySQL result index 4 in C:\xampp\htdocs\debal\nw_check_exec.php on line 40
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 6789 on MySQL result index 4 in C:\xampp\htdocs\debal\nw_check_exec.php on line 41
village: player:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 6790 on MySQL result index 4 in C:\xampp\htdocs\debal\nw_check_exec.php on line 40
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 6790 on MySQL result index 4 in C:\xampp\htdocs\debal\nw_check_exec.php on line 41
village: player:
請你能幫助我嗎?
請不要使用'mysql_ *'函數編寫新代碼。他們不再被維護,社區已經開始貶低過程。相反,你應該瞭解準備語句和使用是'PDO'或'MySQLi'。 – alfasin
$計數器=計數($結果);通過在資源上使用計數,您只能得到1的值。我在代碼中看不到這一點。 – c3cris