Jump to content

bayder

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bayder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I found it. The else is only an else for the last if statement I just changed it to if $r is empty. [code=php:0] function convert_seconds($seconds){     $f_minutes = $seconds / 60;     $i_minutes = floor($f_minutes);     $r_seconds = intval(($f_minutes - $i_minutes) * 60);         $f_hours = $i_minutes / 60;     $i_hours = floor($f_hours);     $r_minutes = intval(($f_hours  - $i_hours) * 60);         $f_days = $i_hours / 24;     $i_days = floor($f_days);     $r_hours = intval(($f_days - $i_days) * 24);         if ($i_days > 0) $r = "$i_days days ";     if ($r_hours > 0) $r .= "$r_hours hours ";     if ($r_minutes > 0) $r .= "$r_minutes min";     if ($r == '') $r = "less than a minute";         return $r; } [/code] Ray...
  2. I just checked this using the following and there are quite a few values that return less than a minute. [code=php:0] function convert_seconds($seconds){     $f_minutes = $seconds / 60;     $i_minutes = floor($f_minutes);     $r_seconds = intval(($f_minutes - $i_minutes) * 60);         $f_hours = $i_minutes / 60;     $i_hours = floor($f_hours);     $r_minutes = intval(($f_hours  - $i_hours) * 60);         $f_days = $i_hours / 24;     $i_days = floor($f_days);     $r_hours = intval(($f_days - $i_days) * 24);         if ($i_days > 0) $r = $i_days."d ";     if ($r_hours > 0) $r .= $r_hours."h ";     if ($r_minutes > 0) $r .= $r_minutes."m";     else $r = "< a min";         return $r; } $count = 30; while($count < 1000000){ if(convert_seconds($count) == "< a min"){ echo  $count; echo "<br />"; } $count = $count + 60; } [/code] Ray...
  3. Hi, I was playing with the convert_seconds function and found that a value of 46800 to 46859 (13 hours to 13 hours 59 seconds) returns "less than a minute". values above 46859 and values below 46800 return the correct time. This is the only range that I have found and I havent found out why its doing this yet. Does anyone else have this issue? Does anyone see where the problem is? I am using PHP ver. 4.4.2 Thanks Ray...
  4. Yes SELECT DISTINCT mystuff FROM table WHERE mystuff NOT LIKE (\"%one%\") OR mystuff NOT LIKE (\"%two%\")\" Thank you
  5. Hi, I am trying to create a query to filter out using \"not like\" now this is fine if I use a single \"not like\", but I always get an error when using a second or more. for example mysql_query(\"SELECT DISTINCT mystuff FROM table WHERE mystuff NOT LIKE \"%one%\" OR mystuff NOT LIKE \"%two%\"\"); which is strange because the \"like\" syntax works fine eg. mysql_query(\"SELECT DISTINCT mystuff FROM table WHERE mystuff LIKE \"%one%\" OR mystuff LIKE \"%two%\"\"); Can anyone enlighten me here please.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.