Atlanticas Posted March 15, 2006 Share Posted March 15, 2006 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] Quote Link to comment Share on other sites More sharing options...
wickning1 Posted March 15, 2006 Share Posted March 15, 2006 Just change two lines:$exp_date=$_db->f('exp_date');$sec_left=$exp_date - $now; Quote Link to comment Share on other sites More sharing options...
Atlanticas Posted March 15, 2006 Author Share Posted March 15, 2006 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!!!! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.