I am following a php pagination tutorial that uses MYSQL, but I use a MYSQLI object oriented around my site. This causes some errors.
For this part ..
$sql = "SELECT COUNT(*) as num FROM categories"; $total_pages = $connection->query($sql) or die(mysqli_error($connection)); $total_pages = $total_pages['num'];
I get a fatal error: you cannot use an object of type mysqli_result as an array .. in the last line
so I switched it to
$sql = "SELECT COUNT(*) as num FROM categories"; $total_pages = $connection->query($sql) or die(mysqli_error($connection)); $row = $total_pages->fetch_assoc(); $total_pages = $row[num];
and now I get the use of the undefined constant num - assuming 'num' .. on the last line.
At this point, I'm not sure what else to do. Can anybody help?
source share