Solved

php employee reviews reminder

Posted on 2011-03-16
2
177 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery force form POST 7 85
Correct syntax for subdirectories 9 33
How to get this library to work load? 8 37
pass foreach data in php into jquery ajax 10 44
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 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