tab_customers_details
in package
Class tab_customers_details
Represents the customers details table in the database.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- $db : db_tenant
Methods
- __construct() : void
- Initializes a new instance of the class.
- __destruct() : void
- Destructs the object and releases any resources associated with it.
- delete() : bool
- Deletes a record from the `customers_details` table based on the provided value and column.
- get() : array<string|int, mixed>|bool
- Fetches a record from the `customers_details` table based on the specified column and value.
- insert() : bool
- Insert a new record into the `customers_details` table.
- update() : bool
- Updates a record in the `customers_details` table with the provided value and column for a specific customer.
Properties
$allowedCols
protected
array<string|int, mixed>
$allowedCols
= ['id', 'customer', 'street', 'zip', 'city', 'country', 'phone', 'mobile', 'cost', 'hours', 'rate', 'ah', 'standby']
An array containing the names of allowed columns in a database table.
$db
protected
db_tenant
$db
The db_tenant object representing the connection to the database
Methods
__construct()
Initializes a new instance of the class.
public
__construct() : void
__destruct()
Destructs the object and releases any resources associated with it.
public
__destruct() : void
The __destruct method is automatically called when the object is no longer referenced and is being destroyed. In this case, it unsets the $db and $allowedCols properties of the object.
delete()
Deletes a record from the `customers_details` table based on the provided value and column.
public
delete(string $val[, string $col = 'customer' ]) : bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'customer'
-
The column to search in. Default is 'customer'. Valid columns are 'id','customer','street','zip','city','country','phone','mobile','cost','hours','rate','ah','standby'.
Return values
bool —True if the record is successfully deleted, false otherwise.
get()
Fetches a record from the `customers_details` table based on the specified column and value.
public
get(string $val[, string $col = 'customer' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the given column.
- $col : string = 'customer'
-
The column to search in (default is 'customer').
Return values
array<string|int, mixed>|bool —Returns an array representing the record found in the table or false if no record is found.
insert()
Insert a new record into the `customers_details` table.
public
insert(string $cid, string $street, string $zip, string $city, string $phone, string $mobile[, string $country = '' ][, string $cost = '' ][, string $hours = '' ][, string $rate = '' ][, string $ah = '' ][, string $standby = '' ]) : bool
Parameters
- $cid : string
-
The customer ID.
- $street : string
-
The customer's street address.
- $zip : string
-
The customer's zip code.
- $city : string
-
The customer's city.
- $phone : string
-
The customer's phone number.
- $mobile : string
-
The customer's mobile number.
- $country : string = ''
-
The customer's country (optional).
- $cost : string = ''
-
The customer's cost (optional).
- $hours : string = ''
-
The customer's hours (optional).
- $rate : string = ''
-
The customer's rate (optional).
- $ah : string = ''
-
The customer's ah (optional).
- $standby : string = ''
-
The customer's standby (optional).
Return values
bool —Returns true on successful insertion, false otherwise.
update()
Updates a record in the `customers_details` table with the provided value and column for a specific customer.
public
update(string $col, string $val, string $cid) : bool
Parameters
- $col : string
-
The column to update in the record. Valid columns are 'id','customer','street','zip','city','country','phone','mobile','cost','hours','rate','ah','standby'.
- $val : string
-
The value to update in the specified column.
- $cid : string
-
The customer ID to find the record to update.
Return values
bool —True if the record is successfully updated, false otherwise.