2017 © Pedro Peláez
 

library mysqli-class

MYSQLi Wrapper

image

nowendwell/mysqli-class

MYSQLi Wrapper

  • Thursday, April 5, 2018
  • by nowendwell
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 51 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

MYSQLi Class

Please understand that using something like this in a modern application is a bad idea. This was created before PDO and Query Builders like those seen in Laravel, CodeIgniter, etc. I highly recommend Laravel if you are looking for a better way., (*1)

PHP class to access MySQL database wrapper using MySQLi, (*2)

This class can:, (*3)

  • Connect to a given MySQL server
  • Execute SQL queries
  • Retrieve the number of query result rows, result columns and last inserted id
  • Retrieve the query results in a single array
  • Escape a single string or an array of literal text values to use in queries
  • Determine if one value or an array of values contain common MySQL function calls
  • Check of a table exists
  • Check of a given table record exists
  • Return a query result that has just one row
  • Execute INSERT, UPDATE, UPSERT(!!!) and DELETE queries from values that define tables, field names, field values and conditions
  • Truncate a table or tables
  • Optimize a table or tables
  • Send email messages with MySQL access and query errors
  • Display the total number of queries performed during all instances of the class

Usage

require_once "class.db.php";
$db = new DB();
foreach( $db->getResults( "SELECT * FROM users_table" ) as $result )
{
  $name = $result['name'];
  $email = $result['email'];

  echo "Name: $name" . "<br />" . "Email: $email" . "<br /><br />";
}

Stored Procedures

showProcedure($procedure)
callProcedure($procedure, $params = array(), $responses = array()), (*4)

Filtering

filter($data)
escape($data)
clean($data), (*5)

Queries (Getting Data)

query($query)
getArray($query, $type = MYSQLI_ASSOC)
getRow($query, $object = false)
getResult($query, $pos = 0)
getResults($query, $object = false), (*6)

Queries (Storing Data)

insert($table, $variables = array())
insertMulti($table, $columns = array(), $records = array())
update($table, $variables = array(), $where = array(), $limit = null)
upsert($table, $data = array(), $where = array()), (*7)

Checks

tableExists($table)
numRows($query)
exists($table = '', $check_val = '', $params = array()), (*8)

Utilities

search($table, $where = array(), $limit = null)
delete($table, $where = array(), $limit = null)
affected()
numFields($query)
showColumns($table)
truncate($tables = array())
optimize($tables = array())
totalQueries()
lastQuery()
lastId(), (*9)

The Versions

05/04 2018

dev-master

9999999-dev https://github.com/nowendwell/mysqli-class

MYSQLi Wrapper

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

  • php >=5.4.0

database wrapper mysql mysqli

05/04 2018

v2.0.0

2.0.0.0 https://github.com/nowendwell/mysqli-class

MYSQLi Wrapper

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

  • php >=5.4.0

database wrapper mysql mysqli

05/04 2018

v1.4.1

1.4.1.0 https://github.com/nowendwell/mysqli-class

MYSQLi Wrapper

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

  • php >=5.4.0

database wrapper mysql mysqli

30/03 2017

1.3

1.3.0.0 https://github.com/nowendwell/mysqli-class

MYSQLi Wrapper

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

  • php >=5.4.0

database wrapper mysql mysqli