tab_users_photo
in package
Class tab_users_photo
This class represents a database table for storing user photos.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- Specifies the allowed columns for a database table.
- $db : db_master
Methods
- __construct() : void
- Class constructor.
- __destruct() : void
- Destructor for the class.
- delete() : bool
- Deletes a record from the "users_photo" table based on the given value and column.
- get() : array<string|int, mixed>|bool
- Retrieves a record from the `users_photo` table based on the specified value and column.
- insert() : bool
- Insert a new record into the `users_photo` table.
- update() : bool
- Updates the "photo" field of a record in the "users_photo" table based on the given UID.
Properties
$allowedCols
Specifies the allowed columns for a database table.
protected
array<string|int, mixed>
$allowedCols
= ['id', 'uid', 'photo']
An array containing the names of the allowed columns.
$db
protected
db_master
$db
The database connection object.
Methods
__construct()
Class constructor.
public
__construct() : void
Initializes a new instance of the class by setting the $db
property.
__destruct()
Destructor for the class.
public
__destruct() : void
This method is automatically called when the object is destroyed. It unsets the $db and $allowedCols properties to free up memory and resources associated with them.
delete()
Deletes a record from the "users_photo" table based on the given value and column.
public
delete(string $val[, string $col = 'uid' ]) : bool
Parameters
- $val : string
-
The value to match against the column.
- $col : string = 'uid'
-
The column to use (default is 'uid' if not specified or invalid).
Return values
bool —Returns true if the record is deleted successfully, false otherwise.
get()
Retrieves a record from the `users_photo` table based on the specified value and column.
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'
-
The column to search for the specified value. Default: 'uid'.
Return values
array<string|int, mixed>|bool —Returns an array containing the first row of the result set if a record is found, otherwise returns false.
insert()
Insert a new record into the `users_photo` table.
public
insert(string $uid, string $photo) : bool
Parameters
- $uid : string
-
The unique identifier of the user.
- $photo : string
-
The photo to be inserted.
Return values
bool —Returns true if the record is inserted successfully, false otherwise.
update()
Updates the "photo" field of a record in the "users_photo" table based on the given UID.
public
update(string $photo, string $uid) : bool
Parameters
- $photo : string
-
The new photo to update.
- $uid : string
-
The UID of the record to update.
Return values
bool —Returns true if the record is updated successfully, false otherwise.