PHP code example of ssnepenthe / wpdb-engine-for-latitude

1. Go to this page and download the library: Download ssnepenthe/wpdb-engine-for-latitude 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/ */

    

ssnepenthe / wpdb-engine-for-latitude example snippets


use Latitude\QueryBuilder\QueryFactory;
use WpdbEngineForLatitude\WpdbEngine;

$factory = new QueryFactory(new WpdbEngine());

use function WpdbEngineForLatitude\field;

$query = $factory
    ->select('id', 'username')
    ->from('users')
    ->where(field('id')->eq(5))
    ->compile();

use function WpdbEngineForLatitude\search;

$query = $factory
    ->select()
    ->from('users')
    ->where(search('first_name')->begins('john'))
    ->compile();

global $wpdb;

$queryString = $wpdb->prepare($query->sql(), ...$query->params());

$result = $wpdb->get_row($queryString);