tab_users_details
in package
Class tab_users_details
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- Define an array of allowed column names.
- $db : db_master
Methods
- __construct() : mixed
- Initializes a new instance of the class.
- __destruct() : mixed
- Destructor method for cleaning up resources before the object is destroyed.
- delete() : bool
- Deletes a record from the `users_details` table based on the provided value and column.
- get() : array<string|int, mixed>|bool
- Retrieves data from the `users_details` table based on the specified column and value.
- insert() : bool
- Inserts user details into the database.
- update() : bool
- Updates a record in the `users_details` table based on the provided column, value, and user ID.
Properties
$allowedCols
Define an array of allowed column names.
protected
array<string|int, mixed>
$allowedCols
= ['id', 'uid', 'first', 'last', 'sal', 'mail', 'phone', 'mobile', 'direct', 'sl']
This array represents a list of column names that are allowed in a certain context. Any column not listed in this array should not be used in that particular context.
$db
protected
db_master
$db
Methods
__construct()
Initializes a new instance of the class.
public
__construct() : mixed
This constructor takes no parameters and assigns the global $dbm
object
to the $db
property of the current instance.
__destruct()
Destructor method for cleaning up resources before the object is destroyed.
public
__destruct() : mixed
Unsets the database connection and allowed columns.
delete()
Deletes a record from the `users_details` table based on the provided value and column.
public
delete(string $val[, string $col = 'uid' ]) : bool
Parameters
- $val : string
-
The value to be deleted.
- $col : string = 'uid'
-
(optional) The column name to search for the value. Default is 'uid'.
Return values
bool —Returns true if the record was successfully deleted, false otherwise.
get()
Retrieves data from the `users_details` table based on the specified column and value.
public
get(string $val[, string $col = 'uid' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'uid'
-
[optional] The column to search in. Defaults to 'uid' if not specified.
Return values
array<string|int, mixed>|bool —Returns an array containing the first row of result if found, or false if no matching row is found.
insert()
Inserts user details into the database.
public
insert(string $uid, string $first, string $last, string $sal, string $mail, string $phone, string $mobile, string $direct, string $sl) : bool
Parameters
- $uid : string
-
The user ID.
- $first : string
-
The user's first name.
- $last : string
-
The user's last name.
- $sal : string
-
The user's salary.
- $mail : string
-
The user's email.
- $phone : string
-
The user's phone number.
- $mobile : string
-
The user's mobile number.
- $direct : string
-
The user's direct contact number.
- $sl : string
-
The user's selectline number.
Return values
bool —Returns true if the user details are successfully inserted, false otherwise.
update()
Updates a record in the `users_details` table based on the provided column, value, and user ID.
public
update(string $col, string $val, string $uid) : bool
Parameters
- $col : string
-
The column name to update.
- $val : string
-
The new value for the specified column.
- $uid : string
-
The user ID to identify the record to be updated.
Return values
bool —Returns true if the record was successfully updated, false otherwise.