PHP Classes

Easy Mysqli OO: Execute common SQL queries using MySQLi extension

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 205 All time: 8,428 This week: 455Up
Version License PHP version Categories
easy-mysqli 1GNU General Publi...5.0PHP 5, Databases
Description 

Author

This class can execute common SQL queries using MySQLi extension.

It can connect to a MySQL database using the MySQLi extension and can execute common queries.

Currently it can SELECT, INSERT, UPDATE and DELETE queries using parameters that define tables, fields, field values, condition clauses, etc..

Picture of Allan Klaus
  Performance   Level  
Name: Allan Klaus <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: 33
All time rank: 4123336 in Brazil Brazil
Week rank: 360 Up30 in Brazil Brazil Up

Recommendations

PDO SQL server connection and execution of stored procedures
want to connect execute sql queries and stored procedures

Example

<?php
require('EasyMysqli.php');
/*
 * DB TEST
 *
DROP TABLE IF EXISTS `tb_users`;
CREATE TABLE IF NOT EXISTS `tb_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `pass` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
 *
*/

$db = new Database();

$table = 'tb_users';
//If you want to debug SQL user the debug true
$debug = false;

$arrayInsert['user'] = 'userName';
$arrayInsert['email'] = 'userEmail';
$arrayInsert['pass'] = 'userPass'; // ENCRYPT IT

//Using insert command
$db->insert($table, $arrayInsert, $debug);
//You can omit $debug like this
//$db->insert($table, $arrayInsert);

//Use simple select command
$result = $db->select($table);

//Using select with WHERE
$whereSelect = 'WHERE id = 1';
$result = $db->select($table, $whereSelect);

//Get result by select
$row = $db->feelArray($result);

//Using update command
$arrayWhere['user'] = 'updateUserName';
$arrayWhere['email'] = 'updateUserEmail';
$arrayWhere['pass'] = 'updateUserPass'; // ENCRYPT IT

$arrayWhere['id'] = 1;
$db->update($table, $arrayUpdate, $arrayWhere);

//Using delete command
$arrayDelete['id'] = 1;
$db->insert($table, $arrayDelete);


Details

easymysqli

Ease way to start the use o mysqli


  Files folder image Files  
File Role Description
Plain text file EasyMysqli.php Class Class file to access database with mysqli
Accessible without login Plain text file README.md Data Auxiliary data
Accessible without login Plain text file sampleEasyMysqli.php Example Example how to use the class

 Version Control Unique User Downloads Download Rankings  
 100%
Total:205
This week:0
All time:8,428
This week:455Up
User Comments (1)
Justo look the delete example and the query method.
8 years ago (André Karell Contreras Jimenez)
7%Star