DataBase Independent package - Unified database access. Extends PHP PDO class.
DataSourceName (dsn) structure: driver://user.password@host/database
Null PHP variable value is treated as database NULL value.


return array resultset where key of a record row array is not numeric index but first field value

  $rows = $db->select ("SELECT ID, Name, Currency, ISOCode FROM Countries", null, null, null, dbi::FETCH_ASSOC_ARRAY);
// $rows value:
    [SI] => Array
            [Name] => Slovenija
            [Currency] => EUR
            [ISOCode] => 978
    [IT] => Array
            [Name] => Italia
            [Currency] => EUR
            [ISOCode] => 978
    [GB] => Array
            [Name] => United Kingdom
            [Currency] => GBP
            [ISOCode] => 826


Global static boolean property to turn on or off debug info dump (shows how SQL is composed and how parameters are bind)

array dbi::splitDSN (string $dsn)

Splits data source name into array parts (driver, db, host, port, user, password)

array dbi::expr (string $value)

Builds internal array structure of database expression for field value.

$fieldValue = dbi::expr("CURDATE()");

array dbi::exprNull (any $value = null, bool $strict = false)

Creates NULL expresion. Optional can test $value value.
$fieldValue = dbi::exprNull(); // NULL
$fieldValue = dbi::exprNull("test"); // test
$fieldValue = dbi::exprNull(0); // NULL
$fieldValue = dbi::exprNull(0, true); // 0

array dbi::isExpr ($value)

Tests if $value is internal array structure of database expression for field value.

string dbi::getExpr ($value)

If $value is expression return expression as string value or else database NULL expression.
$result = dbi::getExpr(dbi::expr ("CURDATE()"); // "CURDATE()"
$result = dbi::getExpr(12); // "NULL"

__construct (string $dsn, bool $ownStatementClass = false)

Constructor of class

Common parameters to all functions:


string form::hidden (string $name, string $value = null, array $attributes = array())

Builds HTML hidden input element.
// Outputs: <input type="hidden" name="actionID" value="save");
echo form::hidden ("actionID", "save");

// Outputs: <input type="hidden" name="actionID" id="actionID" value="save");
echo form::hidden ("#actionID", "save");

string password (string $name, string $value = null, array $attributes = array())

Builds HTML password input element.

string select (string $name, mixed $value = null, array $options = array(), array $attributes = array())

Builds HTML select input element. Options can be grouped. Parameter $value can be string (single select or dropdown) or array type (multi select).

string selectMulti (string $name, mixed $value = null, array $options = array(), array $attributes = array())

Builds jQuery multi select dropdown widget. In dropdown is included filtering, user can select one or more options.
For list of options see authors page.

string selectFilter (string $name, string $select, array $attributes = array())

Builds HTML text input element with $name and binds it to HTML select element. $select can be select element id or any jQuery selector. $attributes are HTML text input element attributes and/or filtering options.
data-filtergroup => false: default; apply filter on select options
data-filtergroup => true: apply filter on select group options (all options of filtered groups are displayed)
  // creates and binds text input with id "countryFilter" to select with id "countries"
  echo form::selectFilter("#countryFilter", "#countries").
       form::select("#countries", $selectedCountry, $countriesOpt, array ("size" => 40));

string text (string $name, string $value = null, array $attributes = array())

Builds HTML text input element.


© 2003-18 iNeta d.o.o. | Koroška cesta 31, SI-4000 Kranj | info@ineta.si | Pravno obvestilo
Powered by BravoCMS