php - Display count of total number of posts -
i wanna show count of total number of posts. using following code 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 * sports title '%$ss%'"; }else{ $query="select * 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 total 120 records inserted in table. please let me know how display count of total number of posts , if new data inserted in table count increase automatic.
i want show count of total number of posts before starting of table.
if got question right, think can use mysqli_num_rows number of elements in result set: check here reference: mysqli_result::$num_rows
Comments
Post a Comment