PHP code example of ulue / miner

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

    

ulue / miner example snippets


$miner = Miner::create()
      ->select('*')
      ->from('shows')
      ->innerJoin('episodes', 'show_id')
      ->where('shows.network_id', 12)
      ->orderBy('episodes.aired_on', Miner::ORDER_BY_DESC)
      ->limit(20);

$miner->getSql(); // Or $miner->getStatement();

$miner->getBoundedParams(); // Or $miner->getPlaceholderValues();

$miner->getSql(false); // Or $miner->getStatement(false);

$PDOStatement = $miner->execute();

$miner = Miner::create($PDO)
$miner = new Miner($PDO);

$miner->setPdoConnection($PDO);

$miner->select('*')
      ->from('shows')
      ->innerJoin('episodes', 'show_id')
      ->where('shows.network_id', 12)
      ->orderBy('episodes.aired_on', Miner::ORDER_BY_DESC)
      ->limit(20);

$miner->insert('shows')
      ->option('HIGH_PRIORITY')
      ->set('network_id', 13)
      ->set('name', 'Freaks & Geeks')
      ->set('air_day', 'Tuesday');

$miner->replace('shows')
      ->set('network_id', 13)
      ->set('name', 'Freaks & Geeks')
      ->set('air_day', 'Monday');

$miner->update('episodes')
      ->set('aired_on', '2012-06-25')
      ->where('show_id', 12)
      ->openWhere(Miner::LOGICAL_OR)
          ->where('name', 'Girlfriends and Boyfriends')
          ->where('air_day', 'Monday', Miner::NOT_EQUALS)
      ->closeWhere();

$miner->delete()
      ->from('shows')
      ->whereIn('show_id', array(12, 15, 20))
      ->limit(3);