復制代碼 代碼如下:
//連接數據庫... 略
$total = 0; //總秒數
$sql = "select duration from test";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
$arr=explode(":",$row[duration]);
$h = $arr[0]*60*60;
$m = $arr[1]*60;
$s = $arr[2];
$total = $h+$m+$s;
}
echo $total;
新聞熱點
疑難解答