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

This package is not auto-updated.

Last update: 2024-09-14 19:42:05 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);