Skip to content
PHP class to perform SQL queries easily
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
composer.json

README.md

simple-sql

PHP class to perform SQL queries easily

Latest Stable Version License

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();
You can’t perform that action at this time.