convert time from database
<p>I have a value in the database defined as mediumint(11).  Currently it returns 3600 if I run a query.</p>

<p>This function here should convert that value to: 1 hr.  But it doesn't when I run the function.  I get no value.</p>

<pre><code>function strTime($s) {
  $d = intval($s/86400);
  $s -= $d*86400;

  $h = intval($s/3600);
  $s -= $h*3600;

  $m = intval($s/60);
  $s -= $m*60;

  if ($d) $str = $d . 'd ';
  if ($h) $str .= $h . 'h ';
  if ($m) $str .= $m . 'm ';
  if ($s) $str .= $s . 's';

  return $str;
 }
</code></pre>

<p>Pretty basic, must be something with the value in the db?</p>

<p>Code that calls this (Joomla specific):</p>

<pre><code>$query = "SELECT streaming_limit FROM #__cc_users WHERE user_id=".$user-&gt;id;
$db-&gt;setQuery($query);
$steaming_limit = $db-&gt;loadResult(); //returns 3600
echo strTime($streaming_limit); //returns nothing
</code></pre>
