<?php $q = $this->db->query("select SUM(pocet_dni) as pocet from holiday where teacher_id="._get_current_user_id($this));
                                 $pocet_dni = $row['pocet'];
                                    echo $pocet;
               ?>


我无法回应SUM。怎么了?

最佳答案

$pocet不存在。使用row_array()

$q = $this->db->query("select SUM(pocet_dni) as pocet from holiday where teacher_id="._get_current_user_id($this))->row_array();
$pocet = $q['pocet'];
echo $pocet;

关于php - 从MySQL回显SUM,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59387383/

10-11 01:42