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++;
}
I want to print all the data that I got from the Select statement. This code is working, but after the end of the table I am getting some erroneous data.
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:
Please could you help me out?
mysql_*functions to write new code. They are no longer maintained and the community has begun deprecation process. Instead you should learn about prepared statements and use eitherPDOorMySQLi.