I’m currently editing a system called RadiPanel and i’m having a few problems, so I thought I’d come over to this forum. Basically I have a code and so far I’ve managed to get it to fetch from the database no problem, but I’m needing a little guidance.
I’m trying to get the code to display the
[php]<?php
require_once(“staff/_inc/glob.php”);
$today = date('N');
$query = $db->query("SELECT * FROM `events` WHERE day = '{$today}' ORDER BY `time` ASC");
$num = $db->num($query);
if (!$num == "0") {
echo "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"1\">";
echo "<tbody>";
echo "<tr style=\"background: #CECECE; font-weight: bold;\">";
echo " <td style=\"background: #D6D6D6; color: #6E6E66; padding: 3px; text-align: center;\"><strong>Event Name</strong></td>";
echo " <td style=\"background: #D6D6D6; color: #6E6E66; padding: 3px; text-align: center;\"><strong>Host</strong></td>";
echo " <td style=\"background: #D6D6D6; color: #6E6E66; padding: 3px; text-align: center;\"><strong>Time</strong></td>";
echo "</tr>";
while ($fetch = $db->assoc($query))
$time = `time`;
$now = date("H:i:s");
$now_plus_one = date("H:i:s")+1;
{
if( $time < $now ) {
echo "<tr style=\"background: #d6d6d6; color: #bfbfbf;\">";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['name']}</td>";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['host']}</td>";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['time']}</td>";
echo "</tr>";
} elseif ( $time >= $now and $time <= $now_plus_one ) {
echo "<tr style=\"background: #CECECE; color: #595953;\">";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['name']}</td>";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['host']}</td>";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['time']}</td>";
echo "</tr>";
} else {
echo "<tr style=\"background: #D6D6D6; color: #6E6E66;\">";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['name']}</td>";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['host']}</td>";
echo " <td style=\"padding: 3px; text-align: center;\">{$fetch['time']}</td>";
echo "</tr>";
}
}
echo "</tbody>";
echo "</table>";
}
else {
echo "<br/><br/><center>No events.</center><br/>";
}
?>[/php]
This is my code, I hope someone can help me, I’m aware some vars are unidentified, thats because I havn’t a clue what to put at them.
I used just TIME in my sql so time shows as 18:00:00 etc.