Esempio n. 1
0
<?php

include 'common_functions.php';
echo "All Customers\n";
echo json_encode(getCustomers());
echo PHP_EOL;
echo "Jason Flores\n";
echo json_encode(getOrdersByCustomer(3));
echo PHP_EOL;
echo "Customer SELECT\n";
echo buildCustomerSelect();
echo PHP_EOL;
Esempio n. 2
0
<?php

include 'common_functions.php';
$custId = isset($_GET['custId']) ? (int) $_GET['custId'] : 0;
$orders = getOrdersByCustomer($custId);
$cust = $custId ? getCustomers(['id' => $custId])[0] : array();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Order History</title>
</head>
<body>
	<form action="M8ex4.php" method="get">
	<?php 
echo buildCustomerSelect($custId);
?>
	<input type="submit" />
	</form>
    <?php 
if ($cust) {
    ?>
        <h1><?php 
    echo $cust['firstname'] . ' ' . $cust['lastname'];
    ?>
</h1>
        <table>
            <thead>
                <tr>
                    <th>Date</th>