# Database Access Object wrapper for PHP and MySqli in a single class (ok)

Note: This release is moved to <https://github.com/EFTEC/PdoOne>

{% embed url="<https://github.com/EFTEC/PdoOne>" %}

Cài đặt&#x20;

```
composer require eftec/pdoone
```

Link: <https://github.com/escuelainformatica/example-pdoone>

**Ví dụ 1:**

Sql file:

{% file src="<https://929787348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRtlBk287z48lyi_B98%2Fuploads%2FEns5vzr8Jp0Bn9amnGgo%2Fexample-pdo.sql?alt=media&token=48d6ea6c-7494-478e-855d-439035fc5285>" %}

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>';
?>
```

![](https://929787348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRtlBk287z48lyi_B98%2Fuploads%2FM1TCgRiZ5PVwpyGyzqew%2FScreenshot_1.png?alt=media\&token=1f1510e3-1995-42ed-a832-f20fb1ae7911)

**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
?>
```

![](https://929787348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MRtlBk287z48lyi_B98%2Fuploads%2FX7pYVe96p6E0UE23B8xS%2FScreenshot_2.png?alt=media\&token=b7d1ccf8-71bb-441d-894f-87a3a9003375)
