Skip to content

Instantly share code, notes, and snippets.

@itswadesh
Last active March 27, 2017 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itswadesh/65ca5b290e842c6320fa426ad3af63db to your computer and use it in GitHub Desktop.
Save itswadesh/65ca5b290e842c6320fa426ad3af63db to your computer and use it in GitHub Desktop.
<?php
include('../includes/config.php');
$query="select distinct c.customerName, c.addressLine1, c.city, c.state, c.postalCode, c.country, c.creditLimit from customers c order by c.customerNumber";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$arr = array();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$arr[] = $row;
}
}
# JSON-encode the response
$json_response = json_encode($arr);
// # Return the response
echo $json_response;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment