2017 © Pedro Peláez
 

library db-mysql

A simple DB layer in PHP for using MySQL

image

jasny/db-mysql

A simple DB layer in PHP for using MySQL

  • Tuesday, January 15, 2013
  • by jasny
  • Repository
  • 1 Watchers
  • 14 Stars
  • 930 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Jasny's DB layer (for MySQL)

Build Status, (*1)

A simple DB layer in PHP for using MySQL, featuring, (*2)

  • Global connection (singleton)
  • Parameter binding
  • Quoting tables/fields and values
  • Fetch all rows, column, key/value pair and single value
  • Simple saving by passing associated arrays
  • Query exceptions (instead of returning false)

Installation

Jasny DB-MySQL is registred at packagist as jasny/db-mysql and can be easily installed using composer. Alternatively you can simply download the .zip and copy the file from the 'src' folder., (*3)

Example

<?php
    new DB($host, $user, $pwd, $dbname);
    $result = DB::conn()->query("SELECT * FROM foo");
    $result = DB::conn()->query("SELECT * FROM foo WHERE type = ?", $type);
    $result = DB::conn()->query("SELECT * FROM foo WHERE type = ? AND cat IN ?", $type, array(1, 7));

    $items = DB::conn()->fetchAll("SELECT id, name, description FROM foo WHERE type = ?", MYSQLI_ASSOC, $type);
    $item  = DB::conn()->fetchOne("SELECT * FROM foo WHERE id = ?", MYSQLI_ASSOC, $id);
    $names = DB::conn()->fetchColumn("SELECT name FROM foo WHERE type = ?", $type);
    $list  = DB::conn()->fetchPairs("SELECT id, name FROM foo WHERE type = ?", $type);
    $name  = DB::conn()->fetchValue("SELECT name FROM foo WHERE id = ?", $id);

    DB::conn()->save('foo', $values);
    DB::conn()->save('foo', array($values1, $values2, $values3));

API documentation (generated)

http://jasny.github.com/DB-MySQL/docs, (*4)

The Versions

15/01 2013

dev-master

9999999-dev http://jasny.github.com/DB-MySQL

A simple DB layer in PHP for using MySQL

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

database mysql db

09/01 2013

v1.1.1

1.1.1.0 http://jasny.github.com/DB-MySQL

A simple DB layer in PHP for using MySQL

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

database mysql db

22/10 2012

v1.0.0

1.0.0.0

A simple DB layer in PHP for using MySQL

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

database mysql db