Vote count:
0
I want to generate a schedule of Dr, Appointment in php.I'm having difficulty trying to implement a way to display appointments into a weekly calendar schedule table (please see below picture) based on the appointment's scheduled day and time.
this is my code:
<?php
$mdate = strtotime("0 day", strtotime(date('d-m-Y')));
$m= date("d-m-Y", $mdate);
$mday=date('l',$mdate);
$tudate = strtotime("+1 day", strtotime(date('d-m-Y')));
$tu= date("d-m-Y", $tudate);
$tuday=date('l',$tudate);
$wedate = strtotime("+2 day", strtotime(date('d-m-Y')));
$we= date("d-m-Y", $wedate);
$weday=date('l',$wedate);
$thdate = strtotime("+3 day", strtotime(date('d-m-Y')));
$th= date("d-m-Y", $thdate);
$thday=date('l',$thdate);
$frdate = strtotime("+4 day", strtotime(date('d-m-Y')));
$fr= date("d-m-Y", $frdate);
$frday=date('l',$frdate);
$stdate = strtotime("+5 day", strtotime(date('d-m-Y')));
$st= date("d-m-Y", $stdate);
$stday=date('l',$stdate);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
echo "<div id='all-departments'>
<table class='timetable'>
<thead>
<tr>
<th><h3>$mday $m</h3></th>
<th><h3>$tuday $tu<h3></th>
<th><h3>$weday $we</h3></th>
<th><h3>$thday $th</h3></th>
<th><h3>$frday $fr</h3></th>
<th><h3>$stday $st</h3></th>
</tr>
</thead>";
echo "<tbody>";
$result= mysqli_query($con,"select distinct timefrom, timeto, day,dte, lock_day from timetable");
while($row= mysqli_fetch_array($result))
{
if($m==$row[dte] || $tu==$row[dte] || $we==$row[dte] || $th==$row[dte] || $fr==$row[dte] || $st==$row[dte])
{
echo "<tr class='row_gray'>";
if($row[day]==$mday && $m==$row[dte]){
$tt= $row[timeto]; $tf=$row[timefrom];
echo "<td rowspan='1' class='event tooltip'>";
echo "<span class='hours'>".$row['timefrom']."-".$row['timeto']."</span><br/>".$row['day']."<br/>";
if($row['lock_day']=='ON')
echo "Available";
else
echo "Not Available";
echo "<div class='tooltip_text'>";
echo "<div class='tooltip_content'>";
echo "<a href='?page=bookings' title='Primary Health Care'>Status of Booking</a>";
echo "$row[timefrom]-$row[timeto]<br />";
echo "Ann Blyumin,";
echo "Office 367, Hall A";
echo "</div>";
echo "</div>";
echo "</td>";
}
else
{
echo "<td rowspan='1' class='event tooltip'></td>";
}
if($row[day]==$tuday && $tu==$row[dte]){
$rs= $row[timeto]- $row[timefrom];
echo "<td rowspan='1' class='event tooltip'>";
echo "<span class='hours'>".$row['timefrom']."-".$row['timeto']."</span><br/>".$row['day']."<br/>";
if($row['lock_day']=='ON')
echo "Available";
else
echo "Not Available";
echo "<div class='tooltip_text'>";
echo "<div class='tooltip_content'>";
echo "<a href='?page=bookings' title='Primary Health Care'>Status of Booking</a>";
echo "$row[timefrom]-$row[timeto]<br />";
echo "Ann Blyumin,";
echo "Office 367, Hall A";
echo "</div>";
echo "</div>";
echo "</td>";
}
else
{
echo "<td rowspan='1' class='event tooltip'></td>";
}
if($row[day]==$weday && $we==$row[dte]){
$rs= $row[timeto]- $row[timefrom];
echo "<td rowspan='1' class='event tooltip'>";
echo "<span class='hours'>".$row['timefrom']."-".$row['timeto']."</span><br/>".$row['day']."<br/>";
if($row['lock_day']=='ON')
echo "Available";
else
echo "Not Available";
echo "<div class='tooltip_text'>";
echo "<div class='tooltip_content'>";
echo "<a href='?page=bookings' title='Primary Health Care'>Status of Booking</a>";
echo "$row[timefrom]-$row[timeto]<br />";
echo "Ann Blyumin,";
echo "Office 367, Hall A";
echo "</div>";
echo "</div>";
echo "</td>";
}
else
{
echo "<td rowspan='1' class='event tooltip'></td>";
}
if($row[day]==$thday && $th==$row[dte]){
$rs= $row[timeto]- $row[timefrom];
echo "<td rowspan='1' class='event tooltip'>";
echo "<span class='hours'>".$row['timefrom']."-".$row['timeto']."</span><br/>".$row['day']."<br/>";
if($row['lock_day']=='ON')
echo "Available";
else
echo "Not Available";
echo "<div class='tooltip_text'>";
echo "<div class='tooltip_content'>";
echo "<a href='?page=bookings' title='Primary Health Care'>Status of Booking</a>";
echo "$row[timefrom]-$row[timeto]<br />";
echo "Ann Blyumin,";
echo "Office 367, Hall A";
echo "</div>";
echo "</div>";
echo "</td>";
}
else
{
echo "<td rowspan='1' class='event tooltip'></td>";
}
if($row[day]==$frday && $fr==$row[dte]){
$rs= $row[timeto]- $row[timefrom];
echo "<td rowspan='1' class='event tooltip'>";
echo "<span class='hours'>".$row['timefrom']."-".$row['timeto']."</span><br/>".$row['day']."<br/>";
if($row['lock_day']=='ON')
echo "Available";
else
echo "Not Available";
echo "<div class='tooltip_text'>";
echo "<div class='tooltip_content'>";
echo "<a href='?page=bookings' title='Primary Health Care'>Status of Booking</a>";
echo "$row[timefrom]-$row[timeto]<br />";
echo "Ann Blyumin,";
echo "Office 367, Hall A";
echo "</div>";
echo "</div>";
echo "</td>";
}
else
{
echo "<td rowspan='1' class='event tooltip'></td>";
}
if($row[day]==$stday && $st==$row[dte]){
$rs= $row[timeto]- $row[timefrom];
echo "<td rowspan='1' class='event tooltip'>";
echo "<span class='hours'>".$row['timefrom']."-".$row['timeto']."</span><br/>".$row['day']."<br/>";
if($row['lock_day']=='ON')
echo "Available";
else
echo "Not Available";
echo "<div class='tooltip_text'>";
echo "<div class='tooltip_content'>";
echo "<a href='?page=bookings' title='Primary Health Care'>Status of Booking</a>";
echo "$row[timefrom]-$row[timeto]<br />";
echo "Ann Blyumin,";
echo "Office 367, Hall A";
echo "</div>";
echo "</div>";
echo "</td>";
}
else
{
echo "<td rowspan='1' class='event tooltip'></td>";
}
echo "</tr>";
}
}
echo "</table>";
echo "</div>"
?>
asked 1 min ago
How I generate schedule of Dr. appointments in php
Aucun commentaire:
Enregistrer un commentaire