PHP code example of zhkugh / epdo

1. Go to this page and download the library: Download zhkugh/epdo 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/ */

    

zhkugh / epdo example snippets




hkugh\Epdo\DB;

// query
$sql = "CREATE TABLE IF NOT EXISTS `travis` (
     	`id` INT(11) NOT NULL AUTO_INCREMENT,
     	`content` text,
     	PRIMARY KEY (`id`)
     ) COLLATE = 'utf8_general_ci' ENGINE = InnoDB AUTO_INCREMENT = 1;";

$bool = DB::query($sql);

// insert
$rowCount = DB::insert('travis', [
    'content' => 'test',
]);

// update
$rowCount = DB::update('travis', [
    'content' => 'NEW VALUE',
], 'id=1');

// run
$PDOStatement = DB::run('SELECT * FROM travis;');

$list = $PDOStatement->fetchAll();

// delete
$rowCount = DB::delete('travis', 'id=1');