Reputation: 18
I am getting error "Trying to get property of non-object on line 76" while executing following:
require_once 'DBConnection.php' ;
$connection = new mysqli($hostname, $username, $password, $database);
if ($connection->connect_error) die ($connection->connect_error);
$query = "Select * From product where productCategory = $productCategory";
$result = $connection->query($query);
$rows = $result->num_rows; //line 76
for ($j = 0 ; $j < $rows ; ++$j)
{
$result->data_seek($j);
$row = $result->fetch_array(MYSQLI_NUM);
Upvotes: 0
Views: 27
Reputation: 960
You should use mysql_num_rows() function. For your given code, it must be like mysql_num_rows($result)
.
You can refer PHP documentation of mysql_num_rows() for further details.
Upvotes: 1