I'm doing my school theater program's website and they need this done Monday morning. I've been working all weekend and am EXTREMELY close to being finished with what they need. However, I just hit a wall and don't know what to do...
I need the code to make it so that all of the TR tags with $start_time_n variables that are !== '00:00:00' show, but it will only show one TR at a time.
Please help! I know the code is messy and probably poorly coded, but I haven't had the time to spend to make it neat and tidy...
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
include ("config.php");
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot connect to database");
$id= "2";
$query = "SELECT * from rehearsal_schedule WHERE id='$id'";
$result = mysql_db_query($db_name,$query,$db);
while($row = mysql_fetch_array($result)) {
$start_time_1 = $row["start_time_1"];
$end_time_1 = $row["end_time_1"];
$start_time_2 = $row["start_time_2"];
$end_time_2 = $row["end_time_2"];
$start_time_3 = $row["start_time_3"];
$end_time_3 = $row["end_time_3"];
$start_time_4 = $row["start_time_4"];
$end_time_4 = $row["end_time_4"];
$start_time_5 = $row["start_time_5"];
$end_time_5 = $row["end_time_5"];
$start_time_6 = $row["start_time_6"];
$end_time_6 = $row["end_time_6"];
$start_time_7 = $row["start_time_7"];
$end_time_7 = $row["end_time_7"];
$start_time_8 = $row["start_time_8"];
$end_time_8 = $row["end_time_8"];
$start_time_9 = $row["start_time_9"];
$end_time_9 = $row["end_time_9"];
$start_time_10 = $row["start_time_10"];
$end_time_10 = $row["end_time_10"];
$type_1 = $row["type_1"];
$type_2 = $row["type_2"];
$type_3 = $row["type_3"];
$type_4 = $row["type_4"];
$type_5 = $row["type_5"];
$type_6 = $row["type_6"];
$type_7 = $row["type_7"];
$type_8 = $row["type_8"];
$type_9 = $row["type_9"];
$type_10 = $row["type_10"];
$description_1 = $row["description_1"];
$description_2 = $row["description_2"];
$description_3 = $row["description_3"];
$description_4 = $row["description_4"];
$description_5 = $row["description_5"];
$description_6 = $row["description_6"];
$description_7 = $row["description_7"];
$description_8 = $row["description_8"];
$description_9 = $row["description_9"];
$description_10 = $row["description_10"];
$am_pm_1a = $row["am_pm_1a"];
$am_pm_1b = $row["am_pm_1b"];
$am_pm_2a = $row["am_pm_2a"];
$am_pm_2b = $row["am_pm_2b"];
$am_pm_3a = $row["am_pm_3a"];
$am_pm_3b = $row["am_pm_3b"];
$am_pm_4a = $row["am_pm_4a"];
$am_pm_4b = $row["am_pm_4b"];
$am_pm_5a = $row["am_pm_5a"];
$am_pm_5b = $row["am_pm_5b"];
$am_pm_6a = $row["am_pm_6a"];
$am_pm_6b = $row["am_pm_6b"];
$am_pm_7a = $row["am_pm_7a"];
$am_pm_7b = $row["am_pm_7b"];
$am_pm_8a = $row["am_pm_8a"];
$am_pm_8b = $row["am_pm_8b"];
$am_pm_9a = $row["am_pm_9a"];
$am_pm_9b = $row["am_pm_9b"];
$am_pm_10a = $row["am_pm_10a"];
$am_pm_10b = $row["am_pm_10b"];
$month = $row["MONTH"];
$day = $row["DAY"];
?>
<center>
<table width="95%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td colspan="2" bgcolor="#A8B2C3"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000"><b><i>Tuesday, <? echo $month; ?> <? echo $day; ?></i></b></font> </center></td></tr>
<?
if ($start_time_1 === '00:00:00') {
?>
<tr>
<td width="25%" bgcolor="#E4E8E8"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><b><? echo substr($start_time_1,0,5); ?> - <? echo substr($end_time_1,0,5); ?></b></font> </center></td>
<td width="75%" bgcolor="#EEF0F0"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><i>There Are No Rehearsals Scheduled For Today</i></font> </center></td></tr>
<?
}
elseif ($start_time_1 !== '00:00:00') {
?>
<tr><td width="25%" bgcolor="#E4E8E8"><center><font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><b><? echo substr($start_time_1,0,5); ?> - <? echo substr($end_time_1,0,5); ?></b></font> </center></td>
<td width="75%" bgcolor="#EEF0F0"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><i><? echo $type_1; ?> - <? echo $description_1; ?></i></font>
</center></td>
</tr>
<?
}
elseif ($start_time_2 !== '00:00:00') {
?>
<tr>
<td width="25%" bgcolor="#E4E8E8"><center><font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><b><? echo substr($start_time_2,0,5); ?> - <? echo substr($end_time_2,0,5); ?></b></font> <center></td>
<td width="75%" bgcolor="#EEF0F0"><center><font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><i><? echo $type_2; ?> - <? echo $description_2; ?></i></font> </center></td></tr>
<?
}
elseif ($start_time_3 !== '00:00:00') {
?>
<tr>
<td width="25%" bgcolor="#E4E8E8"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><b><? echo substr($start_time_3,0,5); ?>
- <? echo substr($end_time_3,0,5); ?></b></font>
</center></td>
<td width="75%" bgcolor="#EEF0F0"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><i><? echo $type_3; ?> - <? echo $description_3; ?></i></font>
</center></td>
</tr>
<?
}
elseif ($start_time_4 !== '00:00:00') {
?>
<tr>
<td width="25%" bgcolor="#E4E8E8"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><b><? echo substr($start_time_4,0,5); ?>
- <? echo substr($end_time_4,0,5); ?></b></font>
</center></td>
<td width="75%" bgcolor="#EEF0F0"><center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#000000"><i><? echo $type_4; ?> - <? echo $description_4; ?></i></font>
</center></td>
</tr>
<?
}
?>
</table><br>
</center>
<?
}
mysql_close($db);
?>
</body>
</html>