Files
bm/public_html/public/tickets/customers.php
2025-09-24 13:26:28 +02:00

53 lines
1.3 KiB
PHP

<?php
/** loads all customers
*
* @version 2.0.0
* @since 2008-02-13
* @author Martin Lenzelbauer
*/
define("ROOT", "../");
require_once(ROOT."include/config.inc.php");
require_once(ROOT."include/db.inc.php");
require_once(ROOT."include/xml.inc.php");
dbQuery("SET NAMES utf8");
switch($_GET['action']){
case "loadCustomers": loadCustomers();
break;
}
/** loads customer data
*/
############################################
function loadCustomers(){
############################################
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$xml .= '<customers>';
$query = sprintf(
"SELECT id, surname, firstname, address, zip, city
FROM bruckm_ticketcustomer
WHERE loose = 'false'
AND address != ''
ORDER BY surname ASC, firstname ASC"
);
$result = dbQuery($query);
while($line = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$xml .= '<customer id="' . $line['id'] . '" firstname="' . xmlstring($line['firstname']) . '" surname="' . xmlstring($line['surname']) . '" ';
$xml .= 'address="' . xmlstring($line['address']) . '" zip="' . xmlstring($line['zip']) . '" city="' . xmlstring($line['city']) . '" />';
}
$xml .= '</customers>';
header('Content-Type: text/xml');
echo $xml;
}
?>