Documentation

tab_logs

Class tab_logs

Represents a log entry in a database table.

Table of Contents

Properties

$allowedcols  : array<string|int, mixed>
$db  : db_master
Represents a database connection.

Methods

__construct()  : void
Class constructor.
__destruct()  : void
Class destructor.
all()  : array<string|int, mixed>|bool
Retrieves all records from the "logs" table, ordered by the specified field in descending order.
delete()  : bool
Deletes a record from the 'logs' table based on the given column and value.
deleteall()  : bool
Deletes all records from the 'logs' table.
get()  : array<string|int, mixed>|bool
Retrieves a record from the "logs" table based on the specified column and value.
getcount()  : string|bool
Retrieves the count of records from the "logs" table based on the specified value and column.
insert()  : bool
Inserts a new record into the 'logs' table.

Properties

$allowedcols

protected array<string|int, mixed> $allowedcols = ['id', 'stamp', 'ip', 'message', 'url', 'attributes']

The array of allowed column names

Tags
since
1.0

Methods

__construct()

Class constructor.

public __construct() : void

Initializes the object and sets the 'db' property to the global '$dbm' variable.

__destruct()

Class destructor.

public __destruct() : void

Removes the 'db' property from the current object by unsetting it.

all()

Retrieves all records from the "logs" table, ordered by the specified field in descending order.

public all([string $sort = 'stamp' ]) : array<string|int, mixed>|bool
Parameters
$sort : string = 'stamp'

(Optional) The field to sort the results by. Defaults to 'stamp'.

Return values
array<string|int, mixed>|bool

Returns an array of records if found, otherwise false.

delete()

Deletes a record from the 'logs' table based on the given column and value.

public delete(string $val[, string $col = 'id' ]) : bool

If the record exists and is successfully deleted, it returns true. Otherwise, it returns false.

Parameters
$val : string

The value to match in the column specified.

$col : string = 'id'

The name of the column to search for the value. Default is 'id'.

Return values
bool

Returns true if the record is successfully deleted, false otherwise.

deleteall()

Deletes all records from the 'logs' table.

public deleteall() : bool

Executes a DELETE query to remove all records from the 'logs' table in the database. Returns true if any records were successfully deleted, otherwise returns false.

Return values
bool

True if any records were deleted, false otherwise.

get()

Retrieves a record from the "logs" table based on the specified column and value.

public get(string $val[, string $col = 'id' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for in the specified column.

$col : string = 'id'

(Optional) The column to search for the specified value. Defaults to 'id'.

Return values
array<string|int, mixed>|bool

Returns an array containing the record if found, otherwise false.

getcount()

Retrieves the count of records from the "logs" table based on the specified value and column.

public getcount([string $val = '' ][, string $col = 'id' ]) : string|bool
Parameters
$val : string = ''

(Optional) The value to match in the specified column. Defaults to an empty string, which retrieves the count of all records.

$col : string = 'id'

(Optional) The column to search for the specified value. Defaults to 'id'.

Return values
string|bool

Returns the count of the records as a string if found, otherwise false.

insert()

Inserts a new record into the 'logs' table.

public insert(string $message, string $url, array<string|int, mixed> $atts) : bool
Parameters
$message : string

The message to be inserted.

$url : string

The URL value to be inserted.

$atts : array<string|int, mixed>

An associative array of attributes to be inserted.

Return values
bool

Returns true if the record is successfully inserted, false otherwise.


        
On this page

Search results