Select::Run

Execute the query

Sintaxe

namespace ProtocolLive\PhpLiveDb;

/**

 */
final class Select{
public function Run(
bool $FetchBoth = false,
bool $Debug = false,
bool $HtmlSafe = true,
bool $TrimValues = true,
bool $Log = false,
int|BackedEnum $LogEvent = null,
int $LogUser = null,
bool $Fetch = false
):array|bool;
}
Parameters

$FetchBoth - Returns an array indexed by both column name and 0-indexed column number as returned in your result set;

$Debug - Dumps in screen the query sended to server. Do not work if a error occurs in the preparation phase;

$HtmlSafe - If HTML tag will be escaped;

$TrimValues - If spaces in the begin and end of the values need to be removed;

$Log - If the query will be logged in the logs table. The table structure are in sql folder;

$LogEvent - An integer to represent the event to be logged;

$LogUser - The user ID to be logged;

$Fetch - If the result will be fetch with the method Run() or method Fetch();

Examples

$consult = $Db->Select('users')
->Run(FetchBoth: true);
/*
[
0 => "1",
"user_id" => '1',
1 => "admin",
"user" => "admin",
2 => "12345678",
"pwd" => "12345678"
]
*/

$consult = $Db->Select('users')
->Run(
Log: true,
LogUser: $_SESSION['user_id'],
LogEvent: SqlLogs::UserSelect
);