我想顯示文章總數的計數。我正在使用以下代碼來顯示錶格數據。顯示文章總數的個數
<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>
我的表格中共插入120條記錄。請讓我知道如何顯示帖子總數,如果在表中插入新數據,則計數將自動增加。
我想顯示開始表之前的帖子總數。
自動之間...... –
簡單,你將獲得數'mysqli_num_rows($結果);?' – JYoThI
請參閱此鏈接將有助於[function.mysql- NUM-行數](http://php.net/manual/en/function.mysql-num-rows.php) –