-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoffice-export.php
28 lines (21 loc) · 908 Bytes
/
office-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
<?php
/*
EXPORT.PHP
Export all data from 'offices' table
*/
// connect to the database
include('linkupdb.php');
//display clean utf8 data
require 'php-excel.class.php';
// get results from database
$result = mysql_query("SELECT officeCode, city, phone, addressLine1, addressLine2, state, country, postalCode, territory FROM offices")
or die(mysql_error());
$data[] = array('officeCode', 'city','phone','addressLine1','addressLine2','state','country','postalCode','territory');
while($row = mysql_fetch_array($result)){
$data[] = array($row['officeCode'],$row['city'],$row['phone'],$row['addressLine1'],$row['addressLine2'],$row['state'],$row['country'],$row['postalCode'],$row['territory']);
}
// generate file (constructor parameters are optional)
$xls = new Excel_XML('UTF-8', false, 'Offices');
$xls->addArray($data);
$xls->generateXML('Exports_OfficesReport');
?>