Solved

php employee reviews reminder

Posted on 2011-03-16
2
169 Views
Last Modified: 2012-05-11
Hi,
I have some code (below) which I use at work to remind me when my employee’s annual reviews are due, the problem I have is the names disappear of the list after a certain amount of time, how could I change the code so I have to confirm the review has been completed before the name disappears?

Regards,
<div id="content_wrapper">
<br/>
	<div class="onecolumn_wrapper">
	 <div class="onecolumn" style="margin-right:20%; margin-left:20%;">
	  <div class="content" >
<?php   

$curdate=date(m);
$query="SELECT * FROM teamdates WHERE MONTH(S_Date)";

$result=mysql_query($query);

$num=mysql_num_rows($result);

mysql_close();

$i=0;
while ($i < $num) {

$Date=mysql_result($result,$i,"Name");

$Date2 = substr($Date,0,10);

$Name=mysql_result($result,$i,"Name");
$S_Date=mysql_result($result,$i,"S_Date");
$ID=mysql_result($result,$i,"ID");

$start_time = strtotime($S_Date);

$print_member = 0;
if ($start_time > time()) {
  // $start_time came from the future.
  echo "Please check employee start date."; //validation
} elseif ($start_time < strtotime("-364 days")) {      
  // $start_time is over 30 days old.
  $type = "Annual review";

  $int2 = 3;
  while (($int1 = strtotime("+".$int2." months", $start_time)) < time()) {
    $int2 += 3;
  }

  if (strtotime("+30 days")  > $int1) {
    //if the review takes place within 7 days from now, print the member.
    $print_member = 1;
    $type_date = date("Y-m-d", $int1);
  }
} 

if ($print_member == 1) {
  echo "Name: <b>$Name</b> 
 <br>Start Date: <b>$S_Date</b>&nbsp;&nbsp; Review Type: <b>$type</b>&nbsp;&nbsp; Review Date: <b>$type_date</b>
 <hr>";
}

$i++;
}


?>

	<br class="clear">
</div> <!-- end content wrapper -->
<br/><br/><br/>

Open in new window

0
Comment
Question by:AlexAmbler
2 Comments
 
LVL 8

Accepted Solution

by:
Rik-Legger earned 500 total points
ID: 35148686
Increase the value from "+ 30 days" to something higher like "+ 1 year".

  if (strtotime("+30 days")  > $int1) {

Open in new window

0
 

Author Comment

by:AlexAmbler
ID: 35148798
I was hoping to confirm using a checkbox or similar
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now