我正在从一个表(名称)中选择数据。在另一张表中我有老师的名字。计算另一行中的条目数
当我从表中选择我的数据时,如何计算每位教师的姓名?
例子:
$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