-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexport_csv.php
More file actions
31 lines (25 loc) · 795 Bytes
/
export_csv.php
File metadata and controls
31 lines (25 loc) · 795 Bytes
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
<?php
/**
* Export CSV
*
* Export record to CSV file
*
* PHP version 7.2.5
*
* @category Main_App
* @package UnlockED
* @author UnlockedLabs <developers@unlockedlabs.org>
* @license https://www.gnu.org/licenses/gpl.html GPLv3
* @link http://unlockedlabs.org
*/
namespace unlockedlabs\unlocked;
// include database and object files
require_once dirname(__FILE__).'/config/database.php';
require_once dirname(__FILE__).'/objects/product.php';
// instantiate database and product object
$database = new Database();
$db = $database->getConnection();
$product = new Product($db);
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=all_products_" . date('Y-m-d_H-i-s') . ".csv");
echo $product->export_CSV();