phyrexia / sql
PHP class to perform SQL queries easily
Installs: 4 422
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.3
- ext-mysqli: *
Suggests
- phyrexia/orm: PHP class for an easy to use ORM
README
PHP class to perform SQL queries easily
Requirements
- PHP >= 5.3
- PHP extension mysqli
Installation
Install directly via Composer:
$ composer require phyrexia/sql
Basic Usage
<?php require 'vendor/autoload.php'; use Phyrexia\SQL\SimpleSQL; //First call: generate instance (next calls won't need parameters, Singleton <3) $SQL = SimpleSQL::getInstance(DATABASE, HOST, PORT, USER, PASS); //Do some SQL query $SQL->doQuery('SELECT * FROM table'); //Count returned rows $count = $SQL->numRows(); //Fetch results (associative array) $rows = $SQL->fetchAllResults(); //Do another SQL query $SQL->doQuery('SELECT * FROM table2 LIMIT 1'); //Fetch a single result $row = $SQL->fetchResult();