Can someone help me with this please? I’m playing with a stat tracker, and with the code snippets below I’m trying to get the total result for each page stored in the database. The problem is that I get this warning when I run the script:
Warning: mysql_result() expects parameter 1 to be resource, object given in C:\webroot\tracker\stats.php on line 11
Warning: mysql_result() expects parameter 1 to be resource, object given in C:\webroot\tracker\stats.php on line 12
Warning: mysql_result() expects parameter 1 to be resource, object given in C:\webroot\tracker\stats.php on line 13
I am using PHP 5.3 and MySQL 5.1.36
<?php
require_once ('mysqli_connect.php');
$query = "SELECT *, count(*) FROM tracker GROUP BY page";
$result = mysqli_query($dbc, $query);
for ($i = 0; $i < mysqli_num_rows($result); $i++)
{
$page = mysql_result($result, $i, "page");
$IP = mysql_result($result, $i, "IP");
$views = mysql_result($result, $i, "count(*)");
echo "page: $page ";
echo "views: $views<br />";
}
?>