Solved

php employee reviews reminder

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it 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 look for a specific file type in a local or remote server directory using PHP.
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…

813 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

16 Experts available now in Live!

Get 1:1 Help Now