i am using mysql_num_rows($query); function to get the total number of rows from table. but it shows zero count.
This is my code
<form method="POST" action="processor.php">
<!-- start data table -->
<table id="table1" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr><th>Video ID</th><th>Video Name</th></tr>
</thead>
<?php
$access = $_SESSION['login'];
if($access == "white"){
$sql = "SELECT * FROM videos ORDER BY id DESC";
$query = $conn->query($sql);
// Return the number of rows in result set
$rowcount=mysql_num_rows($query);
printf("Result set has %d rows.\n",$rowcount);
$i=1;
while ($row = $query->fetch(PDO::FETCH_ASSOC)){
$id = $row['id'];
$video_name = $row['video_name'];
echo "
<tbody>
<tr>
<td style='text-align:center;'>$id</td>
<td id='test10' class='text-center'><b>$video_name</b></td>
</tr>
</tbody>";
} $i++;
}
else {
header ("location:index.php");
}
?>
</table>
<!-- End data table -->
</form>
i want to get the number of count of rows from this statement in above code.
printf("Result set has %d rows.\n",$rowcount);
my result image is also attached.it just shows 0 rows. but my data is shown below image. its not zero. please help how to get count. thanks in advance