I populate a list of dates from a MySQLdatabase like this:
<?php
while ($row = mysql_fetch_array($list_customers)) {
echo "<tr>\n";
echo "<td>".$row['customer_date']."</td>\n";
echo "</tr>\n";
}
?>
Now I would like to add the result inside a <span> that changes class='' based on some criteria:
- If date result is within a 30 days reach from todays date, add
class='yellow' - If date result is over 30 days from today, add
class='green' - If date result has passed, based on todays date, add
class='red'
Would this be possible? Thanks in advance.
Yes it is. Just compare your date with current time using a series of
ifstatements and assign a variable to the class name, like this: