|
![](/images/resource/spacer.gif) |
|
การ count จาก mysql แล้วต้องการเขียนเป็น php code ในส่วนที่เป็น echo ต้องเพิ่มส่วนใหนคะ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Code (PHP)
<?php
session_start();
ob_start();
mysql_connect("localhost","root","123456");
mysql_select_db("project_se_sa");
mysql_query("SET NAMES UTF8");
$teacher = $_REQUEST['teacher_ID'];
$sql = "select count(*) AS `total` ,`teacher_ID`
from `student`
GROUP BY `teacher_ID`
ORDER BY `teacher_ID` ";
$query = mysql_query($sql);
while($result = mysql_fetch_array($query))
{
echo $result["total"];
echo $result["teacher_ID"];
}
?>
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2014-11-01 06:47:14 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|