Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Access-Control-Allow-Origin: *");
- header("Content-Type: application/json; charset=UTF-8");
- $conn = new mysqli("db573884642.db.1and1.com", "dbo573884642", "hS2zKN@hEZyM", "db573884642");
- $result = $conn->query("SELECT EmployeeName, teaTally, coffeeTally FROM Customers");
- $outp = "[";
- while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
- if ($outp != "[") {$outp .= ",";}
- $outp .= '{"Name":"' . $rs["EmployeeName"] . '",';
- $outp .= '"Teas":"' . $rs["teaTally"] . '",';
- $outp .= '"Coffees":"'. $rs["coffeeTally"] . '"}';
- }
- $outp .="]";
- $conn->close();
- echo($outp);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement