tce_db_dal_mysql.php
Tags
Table of Contents
Functions
- F_db_connect() : MySQL
- Open a connection to a MySQL Server and select a database.
- F_db_close() : bool
- Closes the non-persistent connection to a database associated with the given connection resource.
- F_db_error() : string
- Returns the text of the error message from previous database operation
- F_db_query() : false
- Sends a query to the currently active database on the server that's associated with the specified link identifier.<br>
- F_db_fetch_array() : Returns
- Fetch a result row as an associative and numeric array.
- F_db_fetch_assoc() : Returns
- Fetch a result row as an associative array.
- F_db_affected_rows() : Number
- Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
- F_db_num_rows() : Number
- Get number of rows in result.
- F_db_insert_id() : int
- Get the ID generated from the previous INSERT operation
- F_db_datetime_diff_seconds() : SQL
- Returns the SQL string to calculate the difference in seconds between to datetime fields.
- F_escape_sql() : string
- Escape a string for insertion into a SQL text field (avoiding SQL injection).
Functions
F_db_connect()
Open a connection to a MySQL Server and select a database.
F_db_connect([ $host
= 'localhost'
][,
$port
= '3306'
][,
$username
= 'root'
][,
$password
= ''
][,
$database
= ''
]) : MySQL
Parameters
- $host : = 'localhost'
-
(string) database server host name.
- $port : = '3306'
-
(string) database connection port
- $username : = 'root'
-
(string) Name of the user that owns the server process.
- $password : = ''
-
(string) Password of the user that owns the server process.
- $database : = ''
-
(string) Database name.
Return values
MySQL —link identifier on success, or FALSE on failure.
F_db_close()
Closes the non-persistent connection to a database associated with the given connection resource.
F_db_close( $link_identifier)
: bool
Parameters
Return values
bool —TRUE on success or FALSE on failure
F_db_error()
Returns the text of the error message from previous database operation
F_db_error([mixed $link_identifier
= null
]) : string
Parameters
- $link_identifier : mixed = null
Return values
string —error message.
F_db_query()
Sends a query to the currently active database on the server that's associated with the specified link identifier.<br>
F_db_query( $query,
$link_identifier)
: false
Parameters
- $query :
-
(string) The query tosend. The query string should not end with a semicolon.
- $link_identifier :
-
(resource) database link identifier.
Return values
false —in case of error, TRUE or resource-identifier in case of success.
F_db_fetch_array()
Fetch a result row as an associative and numeric array.
F_db_fetch_array( $result)
: Returns
Note: This function sets NULL fields to PHP NULL value.
Parameters
Return values
Returns —an array that corresponds to the fetched row, or FALSE if there are no more rows.
F_db_fetch_assoc()
Fetch a result row as an associative array.
F_db_fetch_assoc( $result)
: Returns
Note: This function sets NULL fields to PHP NULL value.
Parameters
Return values
Returns —an array that corresponds to the fetched row, or FALSE if there are no more rows.
F_db_affected_rows()
Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
F_db_affected_rows( $link_identifier,
$result)
: Number
Parameters
- $link_identifier :
-
(resource) database link identifier.
- $result :
-
(resource) result resource to the query result [UNUSED].
Return values
Number —of rows.
F_db_num_rows()
Get number of rows in result.
F_db_num_rows( $result)
: Number
Parameters
Return values
Number —of affected rows.
F_db_insert_id()
Get the ID generated from the previous INSERT operation
F_db_insert_id( $link_identifier[,
$tablename
= ''
][,
$fieldname
= ''
]) : int
Parameters
- $link_identifier :
-
(resource) database link identifier.
- $tablename : = ''
-
(string) Table name.
- $fieldname : = ''
-
(string) Field name (column name).
Return values
int —ID generated from the last INSERT operation.
F_db_datetime_diff_seconds()
Returns the SQL string to calculate the difference in seconds between to datetime fields.
F_db_datetime_diff_seconds(mixed $start_date_field,
mixed $end_date_field)
: SQL
Parameters
- $start_date_field : mixed
- $end_date_field : mixed
Return values
SQL —query string
F_escape_sql()
Escape a string for insertion into a SQL text field (avoiding SQL injection).
F_escape_sql( $link_identifier,
$str[,
$stripslashes
= true
]) : string
Parameters
- $link_identifier :
-
(resource) database link identifier.
- $str :
-
(string) The string that is to be escaped.
- $stripslashes : = true
-
(boolean) if true strip slashes from string
Tags
Return values
string —Returns the escaped string, or FALSE on error.