<!--?php

    $con = mysqli_connect('localhost', 'mayabeac_wine', '3]eGo-r(Scru',"mayabeac_WineList");
        if (mysqli_connect_errno()) {
            echo"
                Failed to connect to the MySQL DB:".mysqli_connect_error();
            }
           else{

$today = date("Y-m-d");
$sql="SELECT * FROM HotelGuestData WHERE CheckInDate <= '".$today."' AND CheckOutDate -->= '".$today."'";
//$sql="SELECT * FROM HotelGuestData WHERE Status = 'In-House'" ;

$records = mysqli_query($con, $sql);
echo "";
echo "

<style>";<br />
echo "table {font-family: arial, sans-serif; border-collapse: collapse; width: 100%;}";<br />
echo "td, th {border: 1px solid #aaaaaa; text-align: left; padding: 20px;}";<br />
echo "tr:nth-child(even) {background-color: #dddddd;}";<br />
echo "</style>";
echo "";

echo "";

//echo "
<h2>Guest List</h2>
";

echo "

";

echo "

";
echo "

";
echo "

";
echo "

";
echo "

";
echo "

";
echo "

";

while($guests=mysqli_fetch_assoc($records)){

$status = $guests['Status'];

if($guests['CheckOutDate'] == $today AND $guests['Status'] != 'Checked-Out'){

$status = "Checking Out Today";

}

if($guests['CheckInDate'] == $today AND $guests['Status'] != 'In-House'){

$status = "Checking In Today";

}

$in_date = DateTime::createFromFormat('Y-m-d', $guests['CheckInDate'])-&gt;format('M d');
$out_date = DateTime::createFromFormat('Y-m-d', $guests['CheckOutDate'])-&gt;format('M d');

echo "

";
echo "

";
echo "

";
echo "

";
echo "

";
echo "

";
echo "

";

}
echo "
<table style="display: inline-block; text-align: left; width:100%; line-height: 200%; font-size: 150%">
<tbody>
<tr>
<th>Guest Name</th>
<th>Room</th>
<th>Check In</th>
<th>Check Out</th>
<th>Status</th>
</tr>
<tr>
<td>".$guests['FullName']."</td>
<td>".$guests['RoomName']."</td>
<td>";
echo $in_date;
echo "</td>
<td>".$out_date."</td>
<td>".$status."</td>
</tr>
</tbody>
</table>
";
echo"";
echo"";
}
?&gt;