【发布时间】:2015-05-11 06:24:01
【问题描述】:
我从数据库中获取各种行(该列被格式化为日期时间)并将其格式化为仅时间。现在我想将所有行添加到一个 PHP 变量中,我该如何实现呢?
$total_time = $this->fetchTime();
public function fetchTime(){
$catch = 0;
$db = $this->getConn();
$statement = $db->prepare("SELECT log_in FROM attendance");
$statement->execute();
while ($result = $statement->fetch()){
$catch += $result[0]; //This is the part where I do not know how to add time
}
return $catch;
}
【问题讨论】:
-
你能显示一些代码吗? (例如您如何获取行,以及您遇到问题的行)
-
向我展示你的努力?
-
已编辑。有努力。