Download the PHP package jpi/database without Composer
On this page you can find all versions of the php package jpi/database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package database
Database
Simple extension to PDO with some extra convenient methods including simplified parameter binding and easy data fetching. Fully compatible with standard PDO usage, making it easy to use as a drop-in replacement.
Installation
Use Composer
Usage
Initialisation
First, create an instance of the Database class by providing PDO connection parameters:
Available Methods
Extra Methods:
prep(string, array): PDOStatement: when you want to bind some parameters to a queryrun(string, array): PDOStatement: when you bind some parameters to a query and want to execute itselectAll(string, array): array: for aSELECTquery, returns a multidimensional array of all the rows foundselectFirst(string, array): array|null: for aSELECTquery that hasLIMIT 1, returns an associative array of the first row found (if any)getLastInsertedId(): int|null: helpful after anINSERTquery, returns the ID of the newly inserted row
Overridden Methods:
exec(string, array): int: forINSERT,UPDATEandDELETEqueries, returns the number of rows affected
All methods except getLastInsertedId take the query as the first parameter (required), and an array of params to bind to the query (optional).
Examples:
(Assuming instance has been created and set to a variable named $connection)
prep:
run:
selectAll:
selectFirst:
exec:
getLastInsertedId:
Support
If you found this library interesting or useful please spread the word about this library: share on your socials, star on GitHub, etc.
If you find any issues or have any feature requests, you can open a issue or email me @ jahidulpabelislam.com :smirk:.
Authors
Licence
This module is licensed under the General Public Licence - see the licence file for details.
All versions of database with dependencies
ext-pdo Version *