PHP Classes

PHP MySQL Connectors: Execute MySQL and PostGreSQL queries using PDO

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 67 All time: 10,344 This week: 455Up
Version License PHP version Categories
php-mysql-connectors 1.0.0The PHP License5PHP 5, Databases, Configuration
Description 

Author

This package can execute MySQL and PostgreSQL queries using PDO.

It provides a class that can return constant parameters to connect to a database.

Another class can connect to a MySQL or PostgreSQL database using PDO.

It also provides another class that can perform common SQL queries like SELECT, INSERT, UPDATE, and DELETE using parameters that define tables, fields, field values, and conditions.

Picture of Hicri
  Performance   Level  
Name: Hicri <contact>
Classes: 26 packages by
Country: Turkey Turkey
Age: 30
All time rank: 290948 in Turkey Turkey
Week rank: 45 Up1 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Example

<?php

require __DIR__ . '/../vendor/autoload.php';


use
slvler\mysqlconnectors\Constant;
use
slvler\mysqlconnectors\Config\Method;
use
slvler\mysqlconnectors\Database\DatabaseController;


$Constant = new Constant();

$db = new DatabaseController($Constant->showDBHost(), $Constant->showDBName(), $Constant->showDBUser(), $Constant->showDBPassword(), $Constant->showConnection());

$connection = $db->MysqlConnection();
$method = new Method($connection);

$example = $method->Select_all("orders");



$data = array(
   
'ShipName' => "deneme",
   
'ShipAddress' => "deneme",
   
'ShipCity' => "deneme"
);

$method = $method->Insert("orders",$data);

?>


Details

Slvler - php-mysql-connectors

Mysql driver development that can be used on the php side

Installation

To install this package tou can use composer:

    composer require slvler/mysql-connectors

Usage


use slvler\mysqlconnectors\Constant;
use slvler\mysqlconnectors\Config\Method;
use slvler\mysqlconnectors\Database\DatabaseController;


$Constant = new Constant();

$db = new DatabaseController($Constant->showDBHost(), $Constant->showDBName(), $Constant->showDBUser(), $Constant->showDBPassword(), $Constant->showConnection());

Basic Table // use northwind

table "orders"

| OrderID | EmployeeID | ShipName |:-----------:|:------------:|:------------:| | 10249 | 6 | red | 10250 | 4 | yellow | 10251 | 3 | green | 10252 | 4 | yellow | 10253 | 3 | red

Insert Method (TableName, Data = array()):

TableName, Data:

$tableName = "Orders";

$data = Array
(
  "ShipName" => "Blue",
  "ShipAddress" => "Nottingham",
  "ShipCity" => "UK"
);

Insert Method


$methodInsert = $method->Insert($tableName,$data);

Update Method (TableName, Id = array() , Data = array()):

TableName, Id , Data:

$tableName = "Orders";

$Id = array(
 "OrderID" => "1"
);

$data = Array
(
  "ShipName" => "Blue",
  "ShipAddress" => "Nottingham",
  "ShipCity" => "UK"
);

Update Method


$methodUpdate = $method->Update($tableName', $id, $data);

Delete Method (TableName, Id = array()):

TableName, Id:

$tableName = "Orders";

$Id = array(
 "OrderID" => "1"
);

Delete Method


$methodDelete = $method->Delete($tableName,$id);

Select_all Method (TableName):

TableName:

$tableName = "Orders";

Select_all Method


$methodSelectAll = $method->Select_all($tableName);

Select_ch Method (TableName, Data = array()):

TableName, Data:

$tableName = "Orders";

$data = Array
(
  "ShipName", "ShipAddress", "ShipCity"
);

Select_ch Method


$methodSelectCh = $method->Select_ch($tableName,$data);

Select_wh Method (TableName, Data = array(), Conn = array(), If = array()):

TableName, Data, Conn, If:

$tableName = "Orders";

$data = Array
(  
    "EmployeeID" => "4"
);

$conn = Array
(  
    "!="
);

$if = Array
(  
    "AND"
);

Select_wh Method


$methodSelectWh =  $method->Select_wh($tableName, $data, $conn, $if);

Testing

vendor\bin\phpunit

Credits

License

The MIT License (MIT). Please see License File for more information.


  Files folder image Files (13)  
File Role Description
Files folder imageexample (1 file)
Files folder imagesrc (1 file, 2 directories)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (13)  /  example  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (13)  /  src  
File Role Description
Files folder imageConfig (3 files)
Files folder imageDatabase (3 files)
  Plain text file Constant.php Class Class source

  Files folder image Files (13)  /  src  /  Config  
File Role Description
  Plain text file Method.php Class Class source
  Plain text file Sql.php Class Class source
  Plain text file SqlPattern.php Class Class source

  Files folder image Files (13)  /  src  /  Database  
File Role Description
  Plain text file Database.php Class Class source
  Plain text file DatabaseController.php Class Class source
  Plain text file DatabaseFace.php Class Class source

  Files folder image Files (13)  /  tests  
File Role Description
  Plain text file ConnectionTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:67
This week:0
All time:10,344
This week:455Up