如何计算当前行数?
如何在php中计算mysql的当前行数
我想计算当前行数我该怎么做请帮我解决这个问题谢谢请看我的例子
这是代码
$result1 = mysql_query("SELECT fees,name,id,grn,dateofjoin,class,rollno FROM admission where class '2013-04-01' order by class ASC");
while($row = mysql_fetch_array($result1))
{
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['name'] . '</td>';
echo '<td>' . $row['dateofjoin'] . '</td>';
echo '<td>' . $row['grn'] . '</td>';
echo '<td>' . $row['class'] . '</td>';
echo '<td>' . $row['rollno'] . '</td>';
echo "</tr>";
}
echo "<tr>";
echo '<td>Total</td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo '<td></td>';
echo "</tr>";
// close table>
echo "</table>";
现在显示这样
---------------------------------------------------
Id | Name | Date | GRN | Class | Roll No |
---------------------------------------------------
1 | abc | 2013-04-01 | 192 | 10 | 42
4 | xyz | 2013-04-01 | 194 | 10 | 41
6 | ggg | 2013-04-01 | 195 | 10 | 43
9 | dfd | 2013-04-01 | 196 | 10 | 44
--------------------------------------------------
Total
--------------------------------------------------
我想要这样
---------------------------------------------------
Id | Name | Date | GRN | Class | Roll No |
---------------------------------------------------
1 | abc | 2013-04-01 | 192 | 10 | 42
4 | xyz | 2013-04-01 | 194 | 10 | 41
6 | ggg | 2013-04-01 | 195 | 10 | 43
9 | dfd | 2013-04-01 | 196 | 10 | 44
--------------------------------------------------
Total 4 student
--------------------------------------------------