0

I want to get the list of documents that needs to be renewed. The documents expire and needs renewal annually. I want to be alerted 4 months to expiry. I don't know the logic am missing here;

Array for column sorting

 $aColumns = array('ps_id', 'ssc_number', 'submission_type', 'seru', 'jootrh', 'kppb', 'cdc','csc', 'status', 'audit_status', 'comments', 'systemtime','username');

$aResultColumns = array('ps_id','ssc_number', 'submission_type', 'seru', 'jootrh', 'kppb', 'cdc',
    'csc', 'status', 'audit_status', 'comments', 'systemtime', 'username');

Column for indexing and cardinality

$sIndexColumn = "ps_id";

//Table to query

$sTable = "protocol_submissions";

Here's the query. seru is a date variable returned and I want the documents that will expire in 270 days, that is when todays' date is greater that 'seru date+270days'

$sQuery = "SELECT SQL_CALC_FOUND_ROWS " . str_replace(" , ", " ", implode(", ", $aResultColumns)) . "
   FROM   $sTable
   $sWhere WHERE date('m/d/Y', seru +270days) > date('m/d/Y')
   $sOrder 
   $sLimit
";
8
  • u need all 4 months older records? like get all records of may 2016 Commented Aug 18, 2016 at 7:23
  • I suggest to stop using hungarian notations as they make it harder to read your variable names. The interpreter knows what type your variable is. Commented Aug 18, 2016 at 7:23
  • @devpro :-) The dates keep on changing, so, May 2016 will be rigid. Besides, the seru variable has different dates. Commented Aug 18, 2016 at 7:32
  • @DanieleD - the variable names are not in Hungarian. kppb variable is just an abbr of Kenya Pharmacy and Poisons Board so are the rest. Commented Aug 18, 2016 at 7:33
  • @O'Brien Hungarian notations are the naming conventions you're using, which indicate the datatype of your variable as the first character. en.wikipedia.org/wiki/Hungarian_notation Commented Aug 18, 2016 at 7:34

1 Answer 1

1

Try this to get 270 + days from current date:

date('Y-m-d', strtotime("+270 days"));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.