【发布时间】:2013-03-15 08:52:15
【问题描述】:
我需要在变量中获取平均分数。我正在使用zend,我尝试了两个查询,但都没有工作:
$avg_query = $db->query("SELECT sid, AVG(score)
FROM markstable GROUP BY sid");
$avg_query = $db->query("SELECT sid, AVG(score)
FROM markstable WHERE sid = '$sid'");
$avg_score = $db->fetchAll($avg_query);
echo $avg_score; gives nothing
echo $avg_score['$sid']; gives nothing
我需要将avg_score 存储在其他表中。
【问题讨论】:
-
您使用的是哪个 Zend? Zf1 还是 Zf2?
标签: php mysql zend-framework average