This topic is locked

check a check box when record is older then 3 months

7/11/2007 3:35:08 AM
PHPRunner General questions
D
darkmage0 author

Ok so im sorry of this is a dumb question but i have a table called contact history where my users fill out a form when they contact a customer. I need to be able to auto check a check box in that table when a record become older then 3 months so that my users know that they need to contact this customer again.
im using mysql 5 with php 5 running phprunner 4.0
this is the table im working with
select

`Contact History ID`, - int - autoinc

`Contact Date`, - timestamp

`User ID`, - int

`Company ID`, - int

`Company Name`, - varchar

`Contact Person`, - varchar

`Method Of Contact`, -varchar

`Contact Email`, - varchar

`Contact Phone`, - varchar

`Contact Address`, - varchar

`Contact Reason`, - varchar

`Contact Older Then Three Months` - varchar

From `contact history`
so moral of the story i want `Contact Older Then Three Months` which is a check box to become true if `Contact Date` is older then three months.
thx Travis W

J
Jane 7/11/2007

Travis,
to check off Contact Older Then Three Months field automatically use Before record added event.

Here is a sample code:

if ($values["ContactDate"])

{

// split $values["ContactDate"] to array

$arr = db2time($values["ContactDate"]);

// construct time

$t = mktime($arr[3],$arr[4],$arr[5],$arr[1],$arr[2],$arr[0]);

// compare time with current time subtracted by 92 days

if($t < time()-606024*92)

$values["Contact Older Then Three Months"] = "1";

}

D
darkmage0 author 7/12/2007

Hello

thx Jane but i was wondering if this will work on the list page so that all of the records in that table that are over three months will be check off auto.

J
Jane 7/13/2007

No. This code works on the Edit or Add pages only.