Question 1: How can I make a similar statement like in the query (start_date<NOW()) and make that work in my if statement? It is erroring out now in my if statement with ($db->row['date'.$n] > NOW(). It says "undefined function". NOTE: the 'date1' - 'date4' in the mySQL database are TIMESTAMP(14).
Question 2: Is this the right syntax for a for statement to call like this($db->row['date'.$n])? It should essentially read ($db->row['date1']) or wherever it is in the for statement.
<?php
$db->query("SELECT * FROM gtraining WHERE start_date<NOW() AND end_date>NOW() ORDER BY date1");
while($db->fetch()) {
echo "<h4>" . $db->row['title'] . "</h4>\n";
echo "<p>";
for ($i=0; $i<4; $i++) {
$n = $i + 1;
if ($db->row['date'.$n] > NOW() && $db->row['location'.$n] != "") {
echo $db->row['location'.$n] . ": " . $db->row['dates_times'.$n] . "<br />\n";
}
}
echo "<p>" . $db->row['description'] . "</p>\n";
if ($db->row['link_text'] != "") {
echo "<p><img src=\"/g/link.gif\" class=\"icon\" target=\"_blank\" /> <a href=\"" . $db->row['link_url'] . "\">" . $db->row['link_text'] . "</a></p><p><br /></p>";
} else {
echo "</p><p><br /></p>";
}
}
?>