[B]2 Questions
1. I’m stumped. I can’t find this anywhere. I’ve got a time field in my MySQL database (MySQL time format) that I need to total with a query. The database records are songs — so I’m using this field to indicate song length. So using a basic query below, how would I format the times so I could total them up from the query?
[code=php]$query = “SELECT musicTime FROM music WHERE …”;
$result = @mysql_query($query);
if ($result && @mysql_num_rows($result) > 0) {
$totalTime = 0;
while($row = mysql_fetch_array($result)) {
$totalTime = $totalTime + $row[‘musicTime’];
}
print $totalTime;
}
2. In general — when I display times (lengths) anywhere on the site, I never need hours to show. How do I format a time string to remove the hours?
I currently have 00:03:45 and I want to display 3:45.
Thank you for your help!