Better structure
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
include_once 'database.php';
|
||||
include_once "errors.php";
|
||||
include_once "headers.php";
|
||||
Headers::json();
|
||||
include_once "database.php";
|
||||
|
||||
ini_set(display_errors, 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$db = openConnection();
|
||||
$db = DB::openConnection();
|
||||
|
||||
$query = "SELECT * FROM users";
|
||||
|
||||
@@ -12,5 +12,6 @@ $stmt = $db->prepare($query);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
echo json_encode($result);
|
||||
?>
|
||||
DB::closeConnection($db);
|
||||
|
||||
echo json_encode($result);
|
||||
|
||||
Reference in New Issue
Block a user