slvler/mysql-connectors

Mysql driver development that can be used on the php side

v1.2.1 2024-10-20 09:41 UTC

This package is auto-updated.

Last update: 2024-11-20 09:49:21 UTC


README

tests Latest Stable Version Latest Unstable Version License Total Downloads

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"

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.