Example #1
0
 * Project: BPU
 * Company: Fingerprints Ltd
 * Date: 21/09/2016
 * Time: 11:38 AM
 */
require_once 'header.php';
if (isset($_POST['nav-search-box'])) {
    $_SESSION['search'] = $_POST['nav-search-box'];
}
$pagination = new Pagination();
$tables = array('collections' => array('name', 'web_desc', 'amz_desc', 'ebay_desc', 'amz_bullet_1', 'amz_bullet_2', 'amz_bullet_3', 'amz_bullet_4', 'amz_bullet_5'), 'products' => array('name', 'sku', 'filename', 'barcode', 'asin', 'description'));
$table_data = array('headers' => array('type', 'id', 'name', 'fields', 'sm'));
$html->title('Search', null, 'left');
foreach ($tables as $table => $fields) {
    foreach ($fields as $field) {
        $returns = $db->select($table, "`{$field}` LIKE '%" . $_SESSION['search'] . "%'");
        if ($returns) {
            foreach ($returns as $return) {
                $table_data[$table . "_" . $return['id']]['type'] = $table;
                $table_data[$table . "_" . $return['id']]['id'] = $return['id'];
                $table_data[$table . "_" . $return['id']]['name'] = $return['name'];
                $table_data[$table . "_" . $return['id']]['fields'][] = $field;
            }
        }
    }
}
$pages = $pagination->process($table_data);
echo "<div class='row'><div class='col-md-12 text-center'>";
$pagination->nav(array('total_pages' => $pages));
echo "</div></div>";
require_once 'footer.php';