imskully/php-mysqli-simplified

MySQLi interface usage further simplified.

v0.0.3 2021-08-20 04:13 UTC

This package is auto-updated.

Last update: 2024-05-20 04:44:41 UTC


README

Latest Stable Version License composer.lock

A further improved and simplified usage of the MySQLi driver achieved by using overload functions that provide simplistic usage and a shorter syntax.

API Functions

fetch($db, $query)

Executes the specified query and returns the first result.

@param   $db     String  The database name to use for this query.
@param   $query  String  The SQL query.
@return  bool|string[]   The mysqli response if fetch was successful, false otherwise.

fetchAll($db, $query)

Executes the provided query and returns an array of all results.

@param   $db     String  The database name.
@param   $query  String  The SQL query.
@return  array|bool      An array containing the mysqli response if fetch was successful, false otherwise.

execute($db, $query)

Executes the provided query.

@param   $db     String  The database name.
@param   $query  String  The SQL query.
@return  bool            Returns true if the query executed, false otherwise.

escape($data, $db)

Runs the mysqli_escape_string() to escape special characters from the string.

@param   $data   String  The variable or data to escape.
@param   string  $db     The database of which charset to use, if none provided then the default server is used.
@return  String          Returns the data escaped.