Skip to content

A pre-builded php class for using mysql without caring about SQL and XSS attacks

Notifications You must be signed in to change notification settings

Inplex-sys/database-php-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Mysql Database Class

This php class is a simple oriented object mysql client base on pdo, it preventing from SQL injection and XSS attacks.

Init the database object

require 'class/database.class.php'

$GLOBALS['MYSQL'] = new Database(
	"localhost",
	"database",
	"username",
	"password"
);

Getting data from SQL tables

// returning an array of all the table content
$GLOBALS['MYSQL']->getContent("table");

// returning an array of all the table content where exemple_colum is equal to 30
$GLOBALS['MYSQL']->getContent("table", ["exemple_colum" => 30]);

Inserting data into database

// Inserting a new line to the table with exemple_colum equal to 30
$GLOBALS['MYSQL']->Insert("table", [
	"exemple_colum" => 30
]);

// Inserting a new line to the table with exemple_colum equal to 30 without the XSS filter
$GLOBALS['MYSQL']->Insert("table", [
	"exemple_colum" => 30
], false);

Updating data into database

// Put 60 in the column exemple_colum whre exemple_colum equal to 30
$GLOBALS['MYSQL']->update("table", [
	"exemple_colum" => 30
], [
	"exemple_colum" => 60
]);

// Put 60 in the column exemple_colum whre exemple_colum equal to 30 without the XSS filter
$GLOBALS['MYSQL']->update("table", [
	"exemple_colum" => 30
], [
	"exemple_colum" => 60
], false);

Delete a line

// Delete lines where exemple_colum equal to 60
$GLOBALS['MYSQL']->delete("table", [
	"exemple_colum" => 60
]);

About

A pre-builded php class for using mysql without caring about SQL and XSS attacks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages