I'm having an issue with the warning "mysqli_num_rows() expects parameter 1 to be mysqli_result, object given", I'm trying to display content from a database and it seems to be working fine except for this warning. I've tried a lot of methods to fix this but it does not seem to be working. The warning tells me that the line with the problem is "if(mysqli_num_rows($result)>0) {", hope you can help me shed some light on this. Thanks.
<?php
$sql = "SELECT `id`, `name`, `type`, `size`, `url`, `owner`, `created` FROM `files`";
$result = $db->query($sql);
if($result) {
if(mysqli_num_rows($result)>0) {
echo "You have not uploaded any files.";
} else {
echo " <table width='100%'>";
echo "
<tr>
<td>Name</td>
<td>Type</td>
<td>Size</td>
<td>URL</td>
<td>Owner</td>
<td>Created</td>
<td></td>
</tr>";
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
echo "
<tr>
<td>{$row['name']}</td>
<td>{$row['type']}</td>
<td>{$row['size']}</td>
<td>{$row['url']}</td>
<td>{$row['owner']}</td>
<td>{$row['created']}</td>
<td><a href='file?id={$row['id']}'>Download</a></td>
</tr>";
}
echo "
</table>
";
}
}
?>