Face book app help

Discussion in 'PHP' started by bikerboys, Mar 12, 2010.

  1. #1
    Hi all i could use some help getting timers to show up from cron jobs here is the out put code

     <? $timer_item = $appSetting["cron_energy_stemina"]-(time()-$user["last_charge_stemina"]);if($timer_item<=0)echo " More in <span style='color:#ffd004'>".$time.-last_charge_stemina.' sec<span>';else echo " More in <span style='color:#ffd004'>".$timer_item.' sec<span>'; ?>   
    PHP:
    and here is the functions for it
    
    //Cron Job for Stemina
    function CronJobForStemina()
    {
    	$appSetting = ApplicationSetting();
    	$time = time();
    	db_execute("Update user set stemina=stemina+1, last_charge_stemina=".$time." where stemina<stemina_max and (".$time."-last_charge_stemina)>=".$appSetting["cron_energy_stemina"]);
    }
    PHP:
    the cron is set at 5 mins i would like for it to say show more in blanK mins and blank sec

    Im lost i cant figure this out thanks for help in advance

    Thanks
     
    Last edited: Mar 12, 2010
    bikerboys, Mar 12, 2010 IP
  2. bikerboys

    bikerboys Well-Known Member

    Messages:
    308
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #2
    No Body can help with this at all :(
     
    bikerboys, Mar 12, 2010 IP
  3. superdav42

    superdav42 Active Member

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    It looks like simple math to me. Divide by 60 round down with floor() then use mod for the secs. Like:
    <? 
    echo " More in <span style='color:#ffd004'>".floor($timer_item/60).' min and '.$timer_item % 60 ' sec<span>'; ?>
    
    PHP:
     
    superdav42, Mar 12, 2010 IP
  4. bikerboys

    bikerboys Well-Known Member

    Messages:
    308
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #4
    This part of the script
     .$time.-last_charge_stemina.'  
    PHP:
    isnt working not sure what the command should be
     
    bikerboys, Mar 12, 2010 IP