如何統計當前行數?如何統計當前行數
怎麼算的MySQL目前排在PHP
我要統計當前沒有行的我怎麼能做到這一點請大家幫我解決這個問題,感謝 請參閱我的例子
這是代碼
$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
--------------------------------------------------
你只需要'mysql_num_rows()' – 2013-04-22 07:36:52