PHP code example of emonkak / database

1. Go to this page and download the library: Download emonkak/database library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

emonkak / database example snippets


interface PDOInterface extends PDOTransactionInterface
{
    public function errorCode(): ?string;

    public function errorInfo(): array;

    public function exec(string $statement): int|false;

    public function lastInsertId(?string $name = null): string|false;

    public function prepare(string $query, array $options = []): PDOStatementInterface|false;

    public function query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatementInterface|false;

    public function quote(string $string, int $type = PDO::PARAM_STR): string|false;
}

interface PDOTransactionInterface
{
    public function beginTransaction(): bool;

    public function commit(): bool;

    public function inTransaction(): bool;

    public function rollback(): bool;
}

interface PDOStatementInterface extends \Traversable
{
    public function bindValue(string|int $param, mixed $value, int $type = \PDO::PARAM_STR): bool;

    public function errorCode(): ?string;

    public function errorInfo(): array;

    public function execute(?array $params = null): bool;

    public function fetch(int $mode = \PDO::ATTR_DEFAULT_FETCH_MODE, int $cursorOrientation = PDO::FETCH_ORI_NEXT, int $cursorOffset = 0): mixed;

    public function fetchAll(int $mode = \PDO::ATTR_DEFAULT_FETCH_MODE, mixed ...$args): array;

    public function fetchColumn(int $column = 0): mixed;

    public function rowCount(): int;

    public function setFetchMode(int $mode, mixed ...$args): true;
}