我正在从一个表(名称)中选择数据。在另一张表中,我有老师的姓名。
当我从表中选择我的数据时,我如何计算每位教师的姓名总数?
例子:
$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";
}
我怎样才能做到这一点?