QueryHandler - Handling PDO ' s query with mySQL database

Overview

QueryHandler

this class's method are static .... that mean you don't need to create an object to use it . All methodes will return an Exception if it faild .

Open - Close the Connection

To connect to database use openConnection($Host , $DBName , $DBUserName , $DBUserPassword) where : $Host :is your host (localhost or your server IP). $DBName : is your database name that you want to connect it. $DBUserName : is your username that can connect to selected DB. $DBUserPassword : is the user 's password .

Dont't forget to close connection before connection to an other database and don't forget to open connection before calling any query method To close Connection use closeConnection() .


CRUD Methods

All CRUD Methods could be used fo Any table that you want .

Insert Methods

1- insertIntoableByValues($table , $ColumnsAndValuesArray) where : $table is your table name and $ColumnsAndValuesArray is the Post array (or any associative array) . (( don't forget to open connection before calling any query method )) .

2- insertIntoableByqueryStatment($statment , $valuesArrayForAlias = array()) where : $statment is the query that you want to execute it Note : query wil be prepared by prepare PDO method ...... for values use ? and pass the values in $valuesArrayForAlias .

remove Methods

1 - removeItemById($table , $id) where : $table is the table name and $id is Item id that you want to remove it .

2- removeItemByDeleteStatment($statment , $valuesArrayForAlias = array()) where : $statment is the query that you want to execute it Note : query wil be prepared by prepare PDO method ...... for values use ? and pass the values in $valuesArrayForAlias .

Find (get Item Informations) Methodes

1 - getItemAllInfoById($table , $id) where : $table is the table name and $id is Item id that you want to get it's information . //Note : by this method you can only get one row information ...... to get more than use getItems methods

2 - getItemSomeInfoById($table , $arrayOfColumns, $id) where : $table is the table name and $id is Item id that you want to get it's information . and $arrayOfColumns is a indexed array of columns that you want it's values . //Note : by this method you can only get one row's some informations ...... to get more than use getItems methods

3 - getItemInfoBySelectStatement($statment , $valuesArrayForAlias = array()) where : $statment is the query that you want to execute it Note : query wil be prepared by prepare PDO method ...... for values use ? and pass the values in $valuesArrayForAlias . //Note : by this method you can only get one row information ...... to get more than use getItems methods

4 - getItemsSomeInfo($table , $arrayOfColumns) where : $table is the table name , and $arrayOfColumns is a indexed array of columns that you want it's values . this method return multi rows in indexed array of objects.

5 - getItemsInfoBySelectStatement($statment , $valuesArrayForAlias = array()) where : $statment is the query that you want to execute it Note : query wil be prepared by prepare PDO method ...... for values use ? and pass the values in $valuesArrayForAlias . this method return multi rows in indexed array of objects.

update Methods

1 - updateByqueryStatment($statment , $valuesArrayForAlias = array()) where : $statment is the query that you want to execute it Note : query wil be prepared by prepare PDO method ...... for values use ? and pass the values in $valuesArrayForAlias . this method is used to update row or multi row (as you like) by the statment that you write

is item Unique or found Metohds

1 - isItemFoundQueryByValuesAndOperators($table , $arrayOfColumnsAndValues , $OperatorsArrayBetweenColumnValues) where : $table is the table name $arrayOfColumnsAndValues is associative array (key is column name , value is column's value) $OperatorsArrayBetweenColumnValues is an indexed array of operators that you want to put between column and their values (it can take one operator for all columns but if the operators more than one you must write qn equal write of columns
that mean : one operator or (count(OperatorsArrayBetweenColumnValues) == count(arrayOfColumnsAndValues)) must be true . ex : QueryHandler::isItemFoundQueryByValuesAndOperators("users" , array("name" => "Muhammed" , "phoneNumber" => "0999999999") , array("=")); or QueryHandler::isItemFoundQueryByValuesAndOperators("users" , array("name" => "Muhammed" , "phoneNumber" => "0999999999") , array("=" , ">="));

Don't Forget to support me on :

لا تنسى دعمي على

Facebook : https://www.facebook.com/MDRDevelopment/

Instagram : https://www.instagram.com/mdr_development_tr/

You might also like...
PocketMine-MP virion for easy handling of ScoreBoard packets

PocketMine-MP virion for easy handling of ScoreBoard packets

A XOOPS module for handling events, including online registrations.
A XOOPS module for handling events, including online registrations.

wgEvents A XOOPS module for handling events, including online registrations. Support If you like the wgEvents module and thanks to the long process fo

An opinionated extension package for Laravel Orchid to extend its table handling capabilities, and some further useful helper methods.
An opinionated extension package for Laravel Orchid to extend its table handling capabilities, and some further useful helper methods.

OrchidTables An opinionated extension package for Laravel Orchid to extend its table handling capabilities, and some further useful helper methods. In

Icinga Director has been designed to make Icinga 2 configuration handling easy
Icinga Director has been designed to make Icinga 2 configuration handling easy

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.

PHP library for handling sessions

Horizom Session PHP library for handling sessions. Requirements Installation Available Methods Quick Start Usage Tests TODO Changelog Contribution Spo

Receiver is a drop-in webhook handling library for Laravel.

Receiver Receiver is a drop-in webhook handling library for Laravel. Webhooks are a powerful part of any API lifecycle. Receiver aims to make handling

This example shows how to use Anychart library with the PHP programming language, Laravel framework and MySQL database.
This example shows how to use Anychart library with the PHP programming language, Laravel framework and MySQL database.

PHP basic template This example shows how to use Anychart library with the PHP programming language, Laravel framework and MySQL database. Running To

TiDB is an open source distributed HTAP database compatible with the MySQL protocol
TiDB is an open source distributed HTAP database compatible with the MySQL protocol

What is TiDB? TiDB ("Ti" stands for Titanium) is an open-source NewSQL database that supports Hybrid Transactional and Analytical Processing (HTAP) wo

A forum software written in vanilla PHP with a MariaDB/MySQL database.

GloomyBB GloomyBB is a simple forum software written in vanilla PHP with a MariaDB/MySQL database. It is currently still in early development but is u

Comments
  • enhances suggestions

    enhances suggestions

    all notable changes are mentioned in CHANGELOG.md, basically i just re-wrote methods in a much organized readable way, this included

    • getting rid of custom SQL performing methods and replacing all of them with customSQL method.
    • renaming methods to a much appropriate & clean names.
    • adding a .gitignore file. all this required updating README.md & adding a changelog.md files
    opened by adnane-ka 0
Owner
null
Personal PHP MySQL query handler based on Eloquent using PDO.

?? Equivoluent Welcome to "Equivoluent" my personal PHP MySQL query handler using PDO. Equivoluent is based on Laravel's Eloquent. The goal of "Equivo

Wob Jelsma 2 Sep 7, 2022
Aqui são distribídas apostilas sobre alguns assuntos como PHP, PDO, MySQL, PHPOO, MVC, etc

Apostilas de Programação Aqui são distribídas apostilas sobre alguns assuntos como PHP, PDO, MySQL, PHPOO, MVC, etc URL deste repositório https://gith

Ribamar FS 50 Dec 24, 2022
Sistema de login usando PHP, MySQL(PDO),HTML,CSS e bootstrap

sistemalogin link para entrar no projeto: https://williamsistema.000webhostapp.com/ Sistema de login usando PHP, MySQL(PDO),HTML,CSS e bootstrap Requi

William Lima Alves 4 Oct 7, 2022
Firebird-PHP: A library created to meet a work need when handling a Firebird database

Firebird-PHP: A library created to meet a work need when handling a Firebird database

Philipe  Lima 3 Jun 27, 2022
A PHP MySQL database client class to simplify database access

This lightweight database class is written with PHP and uses the MySQLi extension, it uses prepared statements to properly secure your queries, no need to worry about SQL injection attacks.

Khader Handal 50 Jul 30, 2022
CRUD PHP, SQL PDO

PHP-Mastering CRUD em PHP usando MySQL PDO; Configure a ficheiro config.php de acordo com a sua configuração da base de dados PHP CRUD using PDO MySQL

BaltonCome 4 Jun 2, 2022
PHP with PDO (PHP Data Objects) Quickstart

PHP with PDO (PHP Data Objects) Quickstart This repository contains a simple web application that demonstrates how to quickly connect to and communica

Developer Code Central 3 Oct 20, 2022
Decimal handling as value object instead of plain strings.

Decimal Object Decimal value object for PHP. Background When working with monetary values, normal data types like int or float are not suitable for ex

Spryker 16 Oct 24, 2022
Composer script handling your ignored parameter file

Managing your ignored parameters with Composer This tool allows you to manage your ignored parameters when running a composer install or update. It wo

Incenteev 921 Nov 21, 2022
html-sanitizer is a library aiming at handling, cleaning and sanitizing HTML sent by external users

html-sanitizer html-sanitizer is a library aiming at handling, cleaning and sanitizing HTML sent by external users (who you cannot trust), allowing yo

Titouan Galopin 381 Dec 12, 2022