$channel= new channel_oo ($channel, $low_time, $high_time);
Where each database table contains a different channel?
Somewhere to start that off?
Code: Select all
<?php
$host = "localhost";
$user = "frosh_user";
$pass = "frosh_pass";
$db = "frosh_db";
$TimeDiff = date('I');
$TimeZoneEpoc = time() - ($TimeDiff*60*60);
$time = date("g:i:s A", $TimeZoneEpoc);
$unixtime = strtotime($time);
if (!isset($_GET['p_time'])) {
$low_time = floor($unixtime/1800)*1800;
}
else if (ctype_digit($_GET['p_time']) && strlen($_GET['p_time']) === 10) {
$low_time = $_GET['p_time'];
} else {
$low_time = floor($unixtime/1800)*1800;
}
$low_timea = $low_time;
$high_time = $low_time + 7200;
$interval_time = ($high_time - $low_time);
$column_num = ($high_time - $low_time)/3600;
$column_size = 100/$column_num;
echo "Time: $time<BR>";
$dbh = mysqli_connect ($host, $user, $pass, $db) or die ('I cannot connect to the database because: ' . mysqli_error());
$query = "SELECT * FROM disney";
$result = mysqli_query($dbh, $query) or die ("Error in query: $query. ".mysqli_error());
echo "<table width=\"100%\" border=\"1\"><tr>";
for ($i = 0; $i < $column_num; $i++) {
echo "<td width=\"".$column_size."%\">".date("g:i:s A", $low_timea)."</td>";
$low_timea+=3600;
}
echo "</tr></table>";
echo "<table width=\"100%\" border=\"1\"><tr>";
while ($obj = mysqli_fetch_object($result)) {
$item_uid = $obj->tv_uid;
$item_title = $obj->tv_title;
$item_desc = $obj->tv_desc;
$item_pub = $obj->tv_pub;
$item_upubs = $obj->tv_unixtimestamp_start;
$item_upube = $obj->tv_unixtimestamp_end;
if ($item_upubs < $low_time && $item_upube > $high_time) {
$width = (($high_time-$low_time)/($high_time-$low_time))*100;
echo "<td width=\"".$width."%\">". $item_title. " bstart ". $item_pub ."</td>";
}
if ($item_upubs < $low_time && $item_upube > $low_time && $item_upube < $high_time) {
$width = (($item_upube-$low_time)/($high_time-$low_time))*100;
echo "<td width=\"".$width."%\">". $item_title ."</td>";
}
if ($item_upubs == $low_time) {
$width = (($item_upube-$item_upubs)/($high_time-$low_time))*100;
echo "<td width=\"".$width."%\">". $item_title. "</td>";
}
if ($item_upubs > $low_time && $item_upube < $high_time) {
$width = (($item_upube-$item_upubs)/($high_time-$low_time))*100;
echo "<td width=\"".$width."%\">". $item_title. "</td>";
}
if ($item_upubs < $high_time && $item_upube == $high_time) {
$width = (($item_upube-$item_upubs)/($high_time-$low_time))*100;
echo "<td width=\"".$width."%\">". $item_title. "</td>";
}
if ($item_upubs > $low_time && $item_upubs < $high_time && $item_upube > $high_time) {
$width = (($item_upube-$item_upubs)/($high_time-$low_time))*100;
echo "<td width=\"".$width."%\">". $item_title. "</td>";
}
}
echo "</tr></table>";
echo "<a href=\"".$_SERVER['PHP_SELF']."?p_time=".($low_time-7200)."\">PREVIOUS</a>";
echo " || ";
echo "<a href=\"".$_SERVER['PHP_SELF']."?p_time=".($high_time)."\">NEXT</a>";
?>