PHP code example of appzz / sphinxql

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

    

appzz / sphinxql example snippets


//Select query
$db = \AppZz\DB\SphinxQL::factory ('127.0.0.1', 9323)
            ->select('index', ['id', 'title'])
            ->match('@field', 'foobar')
            ->where('field2', '>', 2)
            ->between('field3', 10, 90);
          
$result = $db->execute();
          
if ($result) {
    $data = $db->as_array();
    var_dump($data);
}

//Update RT index
$update = \AppZz\DB\SphinxQL::factory ('127.0.0.1', 9323)
            ->replace('index', ['id', 'title'])
            ->values([11, 'new title'])
            ->execute();          

//affected rows
var_dump($update);