PHP code example of arabcoders / db
1. Go to this page and download the library: Download arabcoders/db 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/ */
arabcoders / db example snippets
= new PDO( 'mysql:host=localhost;dbname=dbName', 'dbUser', 'dbPassword' );
$db = new \arabcoders\db\Db( $pdo );
$insert = $db->insert( 'tableName',[
'id' => 1,
'name' => 'foo'
]);
//-- get last insert id.
$id = $db->id();
// -- update row.
$update = $db->update( 'tableName',
[
'name' => 'bar'
],[
'id' => $id
]
);
$delete = $db->delete( 'tableName', [
'id' => $id
]);