PHP code example of esports / database

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

    

esports / database example snippets


$selection = $context->table('book')
        ->left(':product_price.active', 1)
        ->select('book.*, :product_price.value');

$selection = $context->table('book')
		->left(':product_price.active', 1)
		->where(':book_tag.tag.name LIKE', 'PHP')
		->left(':product_price.value > ?', 0)
		->left(':book_tag.tag_id IS NOT NULL')
		->select('book.*, :product_price.value');

$selection = $context->table('book')
		->left(':product_price.active', 1)
		->left(':book_tag.tag_id IS NOT NULL OR :product_price.active IS NOT NULL') // bude pripojeno k book_tag
		->select('book.*, :product_price.value');

$selection = $context
		->table('book')
		->alias(':product_price', 'pp')
		->left('pp.active', 1)
		->select('book.*, pp.value');

$selection = $context->table('book')
		->alias(':product_price', 'pp')
		->left('pp.active', 1)
		->alias(':book_tag.tag', 't')
		->where('t.name LIKE', 'PHP')
		->left('pp.value > ?', 0)
		->left(':book_tag.tag_id IS NOT NULL')
		->select('book.*, pp.value');

$selection = $context
		->table('book')
		->alias(':product_price', 'pp')
		->left('pp.active', 1)
		->select('book.*, :product_price.value');//tricky

...->where('author.id = (SELECT b.author_id FROM book AS b LIMIT 1)');

$selection = $context->table('author')
        ->where('author.id = (SELECT !b.author_id FROM book AS b LIMIT 1)');

$selection = $context->table('book')
		->forceIndex('use_this_index')
		->select('book.*');