PHP code example of peterujah / php-search-controller

1. Go to this page and download the library: Download peterujah/php-search-controller 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/ */

    

peterujah / php-search-controller example snippets

 
use Peterujah\NanoBlock\SearchController;
$search = new SearchController();

$search->setOperators(SearchController::HAVE_ANY_QUERY);
 
$searchQuery = "PHP Code";
$search->setQuery($searchQuery)->split();
$search->setParameter(array(
    'code_title', 
    'code_description', 
    'code_info'
));
//var_export($search->getQuery());
 
$searchQuery = "PHP Code";
$search->setQuery($searchQuery)->split();
$search->setTags("code_tags");
//var_export($search->getQuery());
 
$search->setIniQuery("SELECT * FROM code WHERE id = 1323");
$db->conn()->prepare($search->getQuery());
$db->conn()->execute();		
$result = $db->conn()->getAll();
$db->conn()->free();
 
$db->conn()->prepare("
    SELECT * FROM code 
    {$search->getQuery()}
    AND id = 1323
");
$db->conn()->execute();		
$result = $db->conn()->getAll();
$db->conn()->free();

$search->getQuery()

$search->setQuery("Foo Bar")

$search->split()

$search->setParameter(array)

$search->setIniQuery('SELECT * FROM ...')