😆Database Access Object wrapper for PHP and MySqli in a single class (ok)
https://github.com/EFTEC/DaoOne
Note: This release is moved to https://github.com/EFTEC/PdoOne
Cài đặt
composer require eftec/pdoone
Link: https://github.com/escuelainformatica/example-pdoone
Ví dụ 1:
Sql file:
C:\xampp\htdocs\test\index.php
<?php
require_once "vendor/autoload.php";
use eftec\PdoOne;
$pdoOne=new PdoOne('mysql','127.0.0.1','root','','example-pdo'); // type of database, server, user, password, schema name.
$pdoOne->open(); // we will open the connection
$customers=$pdoOne->runRawQuery('select * from customers where idcustomer',[1]);
echo '<pre>';
var_export($customers);
echo '</pre>';
?>

Ví dụ 2:
C:\xampp\htdocs\test\index.php
<?php
require_once "vendor/autoload.php";
use eftec\PdoOne;
$pdoOne = new PdoOne('mysql', '127.0.0.1', 'root', '', 'example-pdo'); // type of database, server, user, password, schema name.
$pdoOne->open(); // we will open the connection
$idCustomer = $pdoOne
->from('customers')
->set(['name' => 'John Chain #1'])
->insert(); // $idcustomer gets the identity if any
?>

PreviousLaravel-Blade for php full (ok)NextHướng dẫn tích hợp Ramsey Collection vào để sử dụng với PHP (ok) 👏👏👍
Last updated
Was this helpful?