Jump to content

PHP Language Help!


Atlanticas

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.