我正在從一個表(名稱)中選擇數據。在另一張表中我有老師的名字。計算另一行中的條目數
當我從表中選擇我的數據時,如何計算每位教師的姓名?
例子:
$q = mysql_query("SELECT * FROM names ORDER BY limit 50");
while($row = mysql_fetch_array($q)){
$name = $row['name'];
$teacher $row['teacher'];
$total = ?????
echo "the name is $name and the teacher is $teacher (total number for this teacher is $total";
}
我怎樣才能做到這一點?
你可以發表你的表結構的金額是多少? – 2012-08-14 05:05:47