I wanna show count of total number of posts. I am using following code to show table data.
<table>
<tr>
<th>Id</th>
<th>title</th>
<th>com</th>
<th>com1</th>
</tr>
<tr>
<?php
$limit=10;
if(empty($_GET['p'])){
$start=0;
}else{
$pi=$_GET['p'];
$end=$pi*$limit;
$start=$end-$limit;
}
if(!empty($_GET['s'])){
$ss=$_GET['s'];
$query="select * from sports where title like '%$ss%'";
}else{
$query="SELECT * FROM sports limit $start,$limit";
}
$result=mysqli_query($connect,$query);
while($row=mysqli_fetch_assoc($result)){
?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['title'] ?></td>
<td><?php echo $row['com'] ?></td>
<td><?php echo $row['com1'] ?></td>
</tr>
<?php
}
?>
</table>
There are total 120 records inserted in my table. Please let me know how to display count of total number of posts and if new data is inserted in table then count will increase automatic.
I want to show count of total number of posts before starting of table.