PHP code example of slvler / mysql-connectors

1. Go to this page and download the library: Download slvler/mysql-connectors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

slvler / mysql-connectors example snippets



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());


$tableName = "Orders";

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


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


$tableName = "Orders";

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

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


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


$tableName = "Orders";

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



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


$tableName = "Orders";


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


$tableName = "Orders";

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



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


$tableName = "Orders";

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

$conn = Array
(  
    "!="
);

$if = Array
(  
    "AND"
);



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