2017 © Pedro Peláez
 

library qi-db

Basic database adapter

image

sumpygump/qi-db

Basic database adapter

  • Tuesday, October 8, 2013
  • by sumpygump
  • Repository
  • 1 Watchers
  • 0 Stars
  • 46 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

qi-db

Qi Db provides PHP library classes for running SQL on databases., (*1)

Installation with Composer

Use composer to include the Qi\Db library in a project., (*2)

composer require sumpygump/qi-db

If you don't have composer already installed, this is my recommendation for installing it. See getcomposer.org installation instructions., (*3)

Once the files have been composed with the composer install command, you can use any of the Qi\Db classes after composer's autoloader is included., (*4)

require 'vendor/autoload.php';

$db = new Qi\Db\PdoMysql();
// ...

Manual Installation

You can also download the files and place them in a library folder. If you do this, be sure to update your autoloader to handle the Qi_Db_* classes or else manually include the files of the classes you'll need., (*5)

Basic Usage

This is some example code that illustrates connecting to a Mysql database:, (*6)

$dbConfig = [
    'host' => 'localhost',
    'db'   => 'databasename',
    'user' => 'username',
    'pass' => 'mypassword',
];
$db = new Qi\Db\PdoMysql($dbConfig);

This is some example code that illustrates using the insert() and fetchRow() methods of the PdoMysql class., (*7)

// This will insert a new record into a `users` table
$newRow = [
    'email' => 'test@example.com',
    'first_name' => 'Joe',
    'last_name' => 'Schmoe',
];
$db->insert('users', $newRow);

// This will fetch a user by email address
$user = $db->fetchRow("SELECT * FROM `users` WHERE `email`=?", ['test@example.com']);

Please check the class source code for the full list of other methods that can be used., (*8)

The Versions

08/10 2013

dev-master

9999999-dev http://quantalideas.com/code/qi-db

Basic database adapter

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Jansen Price

database mysql sqlite adapter

08/10 2013

1.2.1

1.2.1.0 http://quantalideas.com/code/qi-db

Basic database adapter

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Jansen Price

database mysql sqlite adapter