Properties

$tableName

$tableName : string

Type

string — - The table name

Methods

__construct()

__construct(\ptejada\uFlex\DB $db, string $table)

Initializes a database table object

Parameters

\ptejada\uFlex\DB $db
string $table

isUnique()

isUnique(string $field, string|int $val, bool|string $customError) : bool

Test field value in database Check for the uniqueness of a value in a specified field/column.

For example could be use to check for the uniqueness of a Username or email prior to registration

Parameters

string $field

The name of the field

string|int $val

The value for the field to check

bool|string $customError

Error string to log if field value is not unique

Returns

bool

getRow()

getRow(array $arguments) : bool|\ptejada\uFlex\Collection

Get a single row from the table depending on arguments

Parameters

array $arguments
  • field and value pair set to look up user for

Returns

bool|\ptejada\uFlex\Collection

getStatement()

getStatement(string $sql, bool|mixed[] $args) : bool|\PDOStatement

Get a PDO statement

Parameters

string $sql

SQL query string

bool|mixed[] $args

argument to execute the statement with

Returns

bool|\PDOStatement

query()

query(mixed $sql, bool $arguments) : bool|\PDOStatement

Query the table

Parameters

mixed $sql
bool $arguments

Returns

bool|\PDOStatement

runQuery()

runQuery(string $sql, array|bool $arguments) : bool

Executes SQL query and checks for success

Parameters

string $sql
  • SQL query string
array|bool $arguments
  • Array of arguments to execute $sql with

Returns

bool

getLastInsertedID()

getLastInsertedID() : int

Get the ID of the last inserted record

Returns

int

buildQuery()

buildQuery(string $sql, array $arguments) : string

Builds a query string with the passed arguments

Parameters

string $sql
array $arguments
  • Associative array of fields and values

Returns

string