slvler / mysql-connectors
Mysql driver development that can be used on the php side
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires (Dev)
- phpunit/phpunit: ^9.5
README
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.