Connecting to a database

Connecting to a database with EasyPDO is a straightforward operation, but depends entirely on the type of database server you're connecting to:

// For MySQL
require_once 'easypdo.mysql.php';
$db = EasyPDO_MySQL::Instance(servername, database name, username, password);

// For Postgres
require_once 'easypdo.postgres.php';
$db = EasyPDO_Postgres::Instance(servername, database name, username, password, port = 5432);

// For SQLite
require_once 'easypdo.sqlite.php';
$db = EasyPDO_SQLite::Instance(database file = null); // Leave blank for an in-memory database
        

The EasyPDO interface provides all the power and flexibility you need to perform any database operation, wrapped in only a few simple methods

interface EasyPDOInterface
{
  function GetConnectionObject();
  function Close();
  function Reset();
  function StartTransaction();
  function RollbackTransaction();
  function CommitTransaction();

  function Fetch($sql);
  function FetchObject($sql);
  function FetchArray($sql);
  function FetchValue($sql);
  function ExecuteSQL($sql);

  static function SetFetchMode($mode);
}
        

Complete documentation will follow soon. In the meantime, please refer to the examples page