CC to show records with start date equal to today or latter

soliver 10 Jun, 2009
Hi Everyone,

I am trying to make this code work. It was working perfectly for me until I needed to add a way to display only current records and not older records.

I want to used the start_date as the field to manage if the record is equal to today or in the future. In other words, do not show records older than today. Code code is 'start_date=>CURdate()' I thought that would work?

These code is located in the Where SQL field of the general section:

Here is what I have:

<?php
$search_array = array('name', 'lineup', 'state','start_date=>CURdate()','end_date');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '%$value%' ";
}
}
if ( !empty($where) ) {
echo " WHERE ".implode(' AND ', $where);
}?>
GreyHead 10 Jun, 2009
Hi soliver

This 'start_date=>CURdate()', is a mess of MySQL and variable names and won't do anything.

You'll need to write some separate code lines to create the startdate 'where' clause.

What are the date formats in the form and the database table?

Bob
soliver 10 Jun, 2009
Hi Grayhead,

start_date is setup as varchar(25) in the table

start_date is setup in the form as 06.10.2009

I hope this help you help me.

Thank you in advance.

I truly appreciate your help!

Scott
GreyHead 10 Jun, 2009
Hi soliver,

Can you save start_date as a MySQL Date or Date time field? That would make it much easier to work with. The mm.dd.yyyy format is not the easiest to unpack.

Bob
soliver 10 Jun, 2009
Greyhead,

Yes, I can. I will change it to a Date field.
So with that said, can you guide me to the correct solution?

Thank You. . .

Scott
Max_admin 17 Jun, 2009
Hi,

another idea is to maybe use strtotime function to compare the dates at the top of the body section and then use "continue" to skip the current row if it fails!🙄

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.