Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $dbname = 'test';
- $charset = 'utf8';
- $dbuser = 'root';
- $dbpassword = '';
- $opt = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
- );
- $dsn = "mysql:host = $host; dbname = $dbname; charset = $charset";
- $pdo = new PDO($dsn, $dbuser, $dbpassword, $opt);
- <?php
- function getAllWorkers() {
- $stmt = $pdo->query('SELECT * FROM `workers`');
- while($row = $stmt->fetch()) {
- echo $row['name'];
- }
- }
- <?php
- function getAllWorkers() {
- global $pdo;
- ...
- <?php
- require_once '../config/config.php';
- require_once '../libs/Functions.php';
- require_once '../config/db.php';
- $controllerName = isset($_GET['controller']) ? ucfirst($_GET['controller']) : 'Index';
- $actionName = isset($_GET['action']) ? $_GET['action'] : 'index';
- loadPage($twig, $controllerName, $actionName);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement