Select

Create an object to run select queries

Sintaxe


namespace ProtocolLive\PhpLiveDb;

public function PhpLiveDb::Select(
string|UnitEnum $Table
bool $ThrowError = true
):Select;
Parameters

$Table - The table to perform the select. The table alias can be specified

$ThrowError - Throw an error if an validating error occurs

Return Values

An object to add options and run the select.

Examples

Normal table name
$consult = $Db->Select('users');
//select * from users
Table name with alias
$consult = $Db->Select('users u');
//select * from users u
Using enum
enum Tables:string{
case Users = 'users';
}

$consult = $Db->Select(Tables::Users);
//select * from users
Subquery as table
$consult = $Db->Select(
'(select * from users where user_act=1) as users'
);
//select * from (select * from users where user_act=1) as users