|
|
|
|
<?php
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Origin: *");
header("Cache-Control: no-cache, must-revalidate");
$host = '127.0.0.1';
$db = 'classicmodels';
$user = 'classicmodelsuser01';
$pass = 'USER01password';
$charset = 'utf8';
$options = [
PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE
=> PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => FALSE,];
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$pdo = new PDO($dsn, $user, $pass, $options);
$customerNumber = $_GET["customerNumber"];
$sql = "select customerNumber, customerName, contactLastName,
contactFirstName, phone, addressLine1, AddressLine2, city, state, postalCode,
country, creditLimit, accountsPayable from customers WHERE customerNumber =
:customerNumber";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':customerNumber',(int) $customerNumber,
PDO::PARAM_INT);
$stmt->execute();
$records = $stmt->fetchAll();
$json = json_encode($records);
$filter1 = str_replace ( ":null",
":\"null\"", $json);
echo $filter1;
?>
|