Solved

php employee reviews reminder

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 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 …

744 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

12 Experts available now in Live!

Get 1:1 Help Now