-
Notifications
You must be signed in to change notification settings - Fork 0
/
xuatExcelPB.php
32 lines (32 loc) · 723 Bytes
/
xuatExcelPB.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
<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=data.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<meta charset="utf-8" />
<table>
<thead>
<tr>
<td>Mã phòng ban</td>
<td>Tên phòng ban</td>
<td>Số điện thoại</td>
</tr>
</thead>
<tbody>
<?php
$conn=new mysqli('localhost','root','','qlnhanvien1');
$sql="select * from phongban";
$result=$conn->query($sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
?>
<tr>
<td><?php echo $row['maphongban']?></td>
<td><?php echo $row['tenphongban']?></td>
<td><?php echo $row['sdt']?></td>
</tr>
<?php }
} ?>
</tbody>
</table>