<?php

header("Content-disposition: attachment; filename=spreadsheet.xls");

session_start();


include "connection.php";

require_once ("includes/loginfunctions.php");
$student="Nil";
$final_report="";


if(checkLoggedin()) { require_once ("includes/functions.php");}else{ header("Location: index.php");}


$data1='';
header("Content-Type: application/vnd.ms-excel");



echo 'Id' . "\t" . 'Name'. "\t" . 'Email'. "\t" . 'Mobile'. "\t" . 'Location'. "\t" . 'Date Of Birth'. "\t" . 'Hotel' ."\n";






$id=" ";
$regno=" ";
$race=" ";
$first=" ";
$last="Not Mentioned";
$gender=" ";
$age=" ";
$birth=" ";
$idtype=" ";
$idnumber=" ";
$address=" ";
$occupation="Not Mentioned";
$phno1=" ";
$ename=" ";
$enumber=" ";
$erelation="Not Mentioned";
$group=" ";
$disease="Not Mentioned";
$size=" ";
$active="";
$active2="";
$email=" ";
$student=" ";
$date=" ";
$time=" ";
$race2=" ";
$gender2=" ";
$amont=" ";
$idtype2=" ";
$group2=" ";
$size2=" ";
$payment=" ";

$query=mysqli_query($conn,"select * from `guest`") or die(mysql_error($conn));
while($row=mysqli_fetch_array($query)){
$gid=$row['gid'];
$name=$row['name'];
$email=$row['email'];
$mobile=$row['mobile'];
$loc=$row['loc'];
$birth=$row['birth'];

				$qry = "select * from `booking` where `gid`='$gid'";
		$res = mysqli_query($conn,$qry) or die(mysqli_error($conn));
		$row = mysqli_fetch_array($res);
			$hid=$row['hotel'];	
			
			
		$qryy = "select * from `hotel` where `hid`='$hid'";
		$res = mysqli_query($conn,$qryy) or die(mysqli_error($conn));
		$row2 = mysqli_fetch_array($res);
		$hname=$row2['title'];


echo $gid . "\t" . $name  . "\t" . $email  . "\t" .$mobile  . "\t" .$race2  . "\t" .$loc  . "\t" .$birth  . "\t".$hname ."\n";


}






?>