-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonalJob_Export.php
43 lines (42 loc) · 1.3 KB
/
PersonalJob_Export.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
session_start();
$TName = $_SESSION["TName"];
//export.php
$connect = mysqli_connect("localhost", "root", "password", "dbtournament");
$output = '';
if(isset($_POST["export"]))
{
$query = "SELECT * FROM $TName";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0) {
$output .= '
<table class="table" bordered="1">
<tr>
<th>MemberName</th>
<th>TeamName</th>
<th>SchoolName</th>
<th>Novice</th>
<th>FoodPreference</th>
<th>ContactDetails</th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["MemberName"].'</td>
<td>'.$row["TeamName"].'</td>
<td>'.$row["SchoolName"].'</td>
<td>'.$row["Novice"].'</td>
<td>'.$row["FoodPreference"].'</td>
<td>'.$row["ContactDetails"].'</td>
</tr>
';
}
$output .= '</table>';
header('Content-Type: application/xls');
header('Content-Disposition: attachment; filename=Database.xls');
echo $output;
}
}
?>