$arr = explode(':', $row['diff']);
echo "$arr[0] minutes, $arr[1] seconds";
Array is outputting: Array00 hours, 20 minutes, when it should be outputting: [x] hours, [x] minutes. ONLY IF there are >= 1 hour
This is in the SQL:
TIMEDIFF(now(), listDT) as diff
Is there someway to show, just minutes, if the output is like 0 hours, 22 minutes? Why is Array in front? Can I remove it? How?
Updated
foreach($result as $row)
{
echo "<div class='listing'>";
print $row['uUName'] . '</strong><br />' .
'<strong>' . $row['listTitle'] . '</strong><br />' .
$arr = explode(':', $row['diff']);
echo "{$arr[0]} minutes, {$arr[1]} seconds";
echo "</div>";
}
This STILL outputs: Array00 hours, 31 minutes for example. How do I get it to look like:
00 hours, 31 minutes
or
(ideally, if hours is 0) 31 minutes
Add braces so that your array vars can be properly interpreted. Like this:
ETA
leaving out the parts that equal zero means looping through the array and asking if the array needs to be output or not.