Part on authorisation finished
This commit is contained in:
parent
0c5e0088f7
commit
44a6d295d8
2 changed files with 26 additions and 15 deletions
15
index.php
15
index.php
|
|
@ -2,14 +2,15 @@
|
|||
require 'functions.php';
|
||||
require 'Database.php';
|
||||
require 'router.php';
|
||||
$username = 'appUser';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$id = $_GET['id'];
|
||||
require 'Response.php';
|
||||
//$username = 'appUser';
|
||||
//$password = 'password';
|
||||
//$config = require('config.php');
|
||||
//$db = new Database($config['database'], $username, $password);
|
||||
//$id = $_GET['id'];
|
||||
// Variante 1
|
||||
$query = "SELECT * FROM posts WHERE id = ?";
|
||||
$posts = $db->query($query, [$id])->fetchAll(PDO::FETCH_ASSOC);
|
||||
//$query = "SELECT * FROM posts WHERE id = ?";
|
||||
//$posts = $db->query($query, [$id])->fetchAll(PDO::FETCH_ASSOC);
|
||||
// Variante 2
|
||||
//$query = "SELECT * FROM posts WHERE id = :id";
|
||||
//$posts = $db->query($query, [':id' => $id])->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue