Jump to content

Archived

This topic is now archived and is closed to further replies.

Atlanticas

PHP Language Help!

Recommended Posts

Basically this coding adds a color desgination for each of my registered users based on how long they have joined. Example: Mike joins on 3/1/06 and is considered Orange during his first 90 days of joining, then turns Blue, etc.

However I want to do the opposite. Instead I want the code to determine the color based on how much membership time is left. For example within the last 90 days of membership, I would like it to put someone as Orange. I hope I am making sense, I had someone do the code for me however he is on vacation and wont be back for a month. Thanks.

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]function get_status_color($member_id)
{
$_db = new mysql_db;
$now=strtotime("now");
$_db->query("SELECT exp_date, join_date FROM member WHERE member_id='".$member_id."'");
$_db->move_next();
$exp_date=$_db->f('join_date');
$sec_left=$now - $exp_date;

if($sec_left <= 0)
{
return 'WHITE';
}

$days_left=$sec_left / 86400;


//echo $days_left;

if($days_left <= 90 )
{
$color='ORANGE;
}
elseif($days_left <= 180 )
{
$color='BLUE';
}
elseif($days_left <= 851 )
{
$color='PURPLE';
}

if($days_left > 851 )
{
$color='PURPLE';
}


return $color;
}




?>[/quote]

Share this post


Link to post
Share on other sites
Wow, thank you so much! I spent many hours on this and never would have guessed. Thank you, I am very appreciative and can't say thanks enough!!!! :)

Share this post


Link to post
Share on other sites

×

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.