<?php

include("dbconnect.php");

$result=mysqli_query($conn,"select * from eventbooking order by id desc");
echo "<table id='tabledesign'>
<tr>
<th align='center'> <b>S.NO</b></th>
<th align='center'><b>EVENT TITLE</b></th>
<th align='center'><b>DEPARTMENT</b></th>
<th align='center'><b>DATE</b></th>
<th align='center'><b>SESSION</b></th>
<th align='center'><b>HALL</b></th>
<th align='center'><b>STATUS</b></th>
<th align='center'><b>ACTION</b></th></tr>";
$i=1;
while($data = mysqli_fetch_assoc($result))
{   
	$d = new DateTime($data['Start']);
	$date = $d->format('d-m-Y');
	//$date = date_create("$d");
	//date_format($date,"d/m/Y");
    echo "<tr>";
	echo "<td>".$i++."</td>";
	echo "<td>".$data['title']."</td>";
    echo "<td>".$data['Department']."</td>";
    echo "<td>".$date."</td>";
	echo "<td>".$data['session']."</td>";
	echo "<td>".$data['Hall']."</td>";
	echo "<td>BOOKED</td>";
	//echo "<td><a onClick='return confirm('Are you sure you want to delete?')' href='delete-event.php?id=$id' type='button' class='btn btn-danger'>delete</a></td>";
	echo "<td><a href='delete-event.php?id=".$_row['id']."'>Delete</a></td>";
    echo "</tr>";
}
echo "</table>";
?>