So, is there a possibility to check $myHours
<?php
$sql = "SELECT * FROM sometable";
$result=mysql_query($sql);
$i = 0;
while($thisResult=mysql_fetch_object($result)) {
$thisID[$i]=$thisResult->id;
$thisTitle[$i]=$thisResult->title;
$thisTimetable[$i]=$thisResult->starth;
$thisDay[$i]=$thisResult->day;
$thisTime[$i]=$thisResult->times;
$thisTimesh[$i]=$thisResult->starth;
$thisTimesm[$i]=$thisResult->startm;
$thisTimeeh[$i]=$thisResult->endh;
$thisTimeem[$i]=$thisResult->endm;
$thisCategory[$i]=$thisResult->category;
$i++;
}
$myTitleLenght = count($myTitle);
echo "<table width=\"100%\" border=\"1\" bordercolor=\"#666666\">";
$myDays = array('Monday','Tuesday','Wednesday','Thursday','Friday');
$myHours = array(9,10,11,12,13,14,15,16,17,18,19,20,21,22,23);
echo "<tr>";
foreach($myDays as $day) {
echo "<td>";
echo $day;
echo "</td>";
}
echo "</tr>";
foreach($myHours as $starth) {
$daycount=0;
foreach($myDays as $day) {
$daycount++;
echo "<td valign=top>";
$count=0;
echo "<table width=\"100%\" border=\"0\">";
foreach($myHours as $i) {
if ($myTimetable[$count]==$starth and $myDay[$count]==$day) {
if ($starth==$i) {
echo "<tr>";
}
echo "<td bgcolor=#ff9999>";
echo "<b>".$myTimetable[$count]."</b><br>";
echo "$myUhrzeitah[$count]:$myUhrzeitam[$count] - $myUhrzeiteh[$count]:$myUhrzeitem[$count]<br><a href='07.php?id=".$myID[$count]."'>".$myTitle[$count]."</a>";
echo "</td>";
echo "</tr>";
}
$count++;
}
echo "</table>";
echo " ";
echo "</td>";
}
echo "</tr>";
}
?>