Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php employee reviews reminder

Posted on 2011-03-16
2
Medium Priority
?
193 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 2000 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

Hire Technology Freelancers with Gigs

Work with 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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

927 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