vanokk / singleton-pdo
There is no license information available for the latest version (1.1.0) of this package.
Sigleton PDO
1.1.0
2016-03-22 19:55 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-01-04 21:13:59 UTC
README
Installation
composer require "vanokk/singleton-pdo"
Usage
For example create database and make dump from sql/users.sql. In example.php set value for host, DB name, user name and user password.
<?php require_once 'src/autoload.php'; $host = 'localhost'; $dbName = 'users'; $userName = 'root'; $userPassword = 'root'; $db = SingletonPDO\DB::connect('mysql:host='.$host.';dbname='.$dbName, $userName, $userPassword); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $query = new SingletonPDO\DBQuery($db); $sql = "SELECT * FROM users"; echo $query->queryAll($sql);