HOW TO INSTANCE THE CLASS?
include("config.php");
include("mysql.class.php");

$db = new mysql();
INSERTS
nextid([table],[key])

insert([table],[values],[key],[key_value])
INSERT WITH THE NEXT ID IN A VARIABLE
// define the values of the query in a array or object
$values["fname"] = "Rodrigo";
$values["lname"] = "Brandão";
$values["birth"] = "19851210";

// use this function to get the next id from a table
$id = $db->nextid("table","id");

// execute the insert query
$db->insert("table",$values,"id",$id);
INSERT INTO A TABLE WITH AUTO-INCREMENTO ID
// define the values of the query in a array or object
$values["fname"] = "Rodrigo";
$values["lname"] = "Brandão";
$values["birth"] = "19851210";

// execute the insert query (the return will be the id added)
$id = $db->insert("table",$values);
DELETES
delete([table],[key],[key_value])
// sets the id of the row that will be deleted
$id = 99;

// execute the delete query
$db->delete("table","id",$id);
UPDATES
simple_update([table],[values],[key],[key_value])

update([table],[values],[where])
EXECUTE A SIMPLE UPDATE QUERY
// sets the id of the row that will be updated
$id = 1;
// define the values of the query in a array or object
$values = (object)NULL;
$values->fname = "Rodrigo";
$values->lname = "Brandão";
$values->birth = "19851210";
// execute the update query
$db->simple_update("table",$values,"id",$id);
EXECUTE A UPDATE QUERY WITH THE 'WHERE' ARE ADDED MANUALLY
// define the values of the query in a array or object
$values = (object)NULL;
$values->fname = "Rodrigo";
$values->lname = "Brandão";
$values->birth = "19851210";

// execute the update query
$db->update("table",$values,"id >= 10");
SELECTS
simple_select([table],[cols],[key],[key_value],[order],[limit_ini],[limit_end])

select([table],[cols],[where],[order],[limit_ini],[limit_end])
EXECUTE A SIMPLE SELECT QUERY
// sets the id of the row that will be selected
$id = 1;

// execute the simple select query
$sselect = $db->simple_select("table","*","id",$id);

// show the return
var_dump($sselect);
EXECUTE A SELECT QUERY WITH THE 'WHERE' ARE ADDED MANUALLY

// execute the select query
$select = $db->select("table","id,lname",'(`id` > 1) AND (`id` < 5)',"lname",0,5);

// show the return
var_dump($select);
SEARCH QUERY
search([table],[cols],[where],[is],[order],[limit_ini],[limit_end])
// execute a search query
$search = $db->search("table","*","lname","Rodrigo%");

// show the return
var_dump($search);
EXECUTE A QUERY
secure([value])

query([sql])
// calls the function which protects the variable from sql injection
$fname = $db->secure("Rodrigo'; drop table example; --");
$lname = $db->secure("Brandão");

// execute a complex query
$complex = $db->query("SELECT * FROM `table` WHERE `fname`='".$fname."' AND `lname`='".$lname."'");

// show the return
var_dump($complex);
HOW USE ANOTHER DATABASE IN THE SAME TIME?
$host = "localhost";
$user = "root";
$pass = "root";
$name = "database";
$char = "utf8";
$db2 = new mysql($host,$user,$pass,$name,$char);
HOW TO ACTIVATE DEBUGGING PROCESS?
config.php
define("DB_DEBUG",true);