Display text or image using Show If dependent on date in database
I'm trying to build in a 'traffic light' system on my results page which will show an image or text depending on the date in the recordset. For example, all records with a date 6 months or less in the future would display a red image, records between 6-12 months would display amber and between 12-18 months would be green. I have tried the following but it doesn't work:
<?php if ($row_WADAclients['StagingDate'] > 'DATE_ADD(now(), INTERVAL 6 MONTH') { // Show if column... ?>
<img src="red.png"/>
<?php } // Show if column... ?>
If I use > as the operator it doesn't display regardless of the date, if I use < it displays on all of them. Any ideas how I can get this to work?