miDBUtilImpl constructor.
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
miDBUtilImpl
__construct
(string $dbHost, string $dbUser, string $dbPass, string $dbName)
-
string
$dbHost: host name
-
string
$dbUser: username
-
string
$dbPass: password
-
string
$dbName: database name
Executes a SQL delete query for a specify record key
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
void
execDelete
(string $table, string $key, int $keyval)
-
string
$table: database table name
-
string
$key: name of the key field
-
int
$keyval: value of the key field
Executes a SQL insert query from an associative array.
Associative array is representing one record where keys are the table fields names. Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
//$values is an associative array with data for inserting
?>
int
execInsert
(string $table, array $values)
-
string
$table: table name
-
array
$values: associative arrays with data for inserting
Returns an array with associative arrays from the result
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
array
execSelect
(string $query, [array $params = array()])
-
string
$query: query string
-
array
$params: positional query params (optional)
Executes the select query and also returns the selected column names in the $fieldsArray
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
array
execSelectAndGetFields
(string $query, &$fieldsArray, array $fieldsArray)
-
string
$query: query string
-
array
$fieldsArray: array for names of the fields
-
&$fieldsArray
Executes a SQL query
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
$rezult =
$DBUtilImpl->execSQL($query);
?>
mixed
&execSQL
(string $query, [array $params = array()])
-
string
$query: query string
-
array
$params: positional params (optional)
Executes a SQL insert query
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
int
execSQLInsert
(string $query)
-
string
$query: query string
Executes a SQL update query from an array for a specify record key
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
$DBUtilImpl->execUpdate($table, $values, $key, $keyval);
?>
void
execUpdate
(string $table, array $values, string $key, int $keyval)
-
string
$table: database table name
-
array
$values: associative arrays with data for updating
-
string
$key: name of the key field
-
int
$keyval: value of the key field
Returns an array with names of the fields in the specified table.
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
array
&getTableFields
(string $table)
-
string
$table: database table name
Connects to a SQL database
Example:
<?php
$DBUtilImpl =
new miDBUtilImpl($dbHost, $dbUser, $dbPass, $dbName);
?>
resource
pconnect
()
Ping the database and attempt to reconnect if necessary
false
ping
()