Hi
I have 7 arrays for all containing the same data:time_id,
start_time, end_time and colour.
Each array represent a day of the week.
There are a total of seven columns to display.
I have combined them into a three multi dimentional to
display data form the 7 layers which are the days.
Is this the best way to accomplish my goal?
The results are not what displaying properly.
The columns are all not starting at the top of the screen and they should.
note: This is the result, each line represents the top of a column.
The columns should be at the same level.
|------|
|------|-------|
|------|-------|-------|
|------|-------|-------|-------|
|------|-------|-------|-------|-------|
|------|-------|-------|-------|-------|-------|
|------|-------|-------|-------|-------|-------|--------|
|------|-------|-------|-------|-------|-------|--------|
<?
echo"<table>";
//get availability nfo
$query = "SELECT DISTINCT(a.time_id), a.start_time, a.end_time, c.colour
FROM available a, type_display c
WHERE a.type_code = c.type_code
AND '$event_date' BETWEEN a.start_date AND a.end_date
AND a.org_pro_id = '$org_pro_id'
AND a.week_day = '$day'
GROUP BY a.start_time";
$result = mysqli_query($mysqli, $query) or die('Error, query failed');
while($row = mysqli_fetch_array($result))
{
$avail_day1[] = $row; //this only shows one of the seven days to save on clutter
}
/**Note:all contain table data time_id, start_time, end_time, colour**/
$all_avail_days = array($avail_day1, $avail_day2, $avail_day3, $avail_day4,
$avail_day5, $avail_day6, $avail_day7);
for($wk_day =0; $wk_day < count($all_avail_days); $wk_day++)//wk_day layer
{
$day = $wk_day + 1; echo":";
foreach($all_avail_days as $key => $avail)//rows
{
for($j = 0; $j < count($all_avail_days[$key]); $j++)//column
{
if($day == 1)
{
$time_id1 = $all_avail_days[$wk_day][$key][time_id];
$type_start_time1 = $all_avail_days[$wk_day][$key][start_time];
$type_end_time1 = $all_avail_days[$wk_day][$key][end_time];
$colour1 = "#".$all_avail_days[$wk_day][$key][colour]."</br>";
}
//Note: days 2 to 6 removed to limit clutter..........
if($day == 7)
{
$time_id7 = $all_avail_days[$wk_day][$key][time_id];
$type_start_time7 = $all_avail_days[$wk_day][$key][start_time];
$type_end_time7 = $all_avail_days[$wk_day][$key][end_time];
$colour7 = "#".$all_avail_days[$wk_day][$key][colour]."</br>";
}
echo"<tr>
<td width=\"8%\" height=\"12\"> </td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour1\">
$type_start_time1</td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour2\">
$type_start_time2</td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour3\">
$type_start_time3</td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour4\">
$type_start_time4</td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour5\">
$type_start_time5</td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour6\">
$type_start_time6</td>
<td width=\"13%\" height=\"12\" bgcolor=\"$colour7\">
$type_start_time7</td>";
echo"</tr>\n";
}
}
}
echo"</table>";
?>