Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

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();