search array

[email protected] (Russell Brackett)
Newsgroups php.general
Message-ID <[email protected]>
I need help with this code to echo all items in the general database and not just the fields I'm searching for.....

<?php

// filter function
function cleanInput($input) {

                $search = array('OEM Name, Category, OEM Name');

                $output = str_replace($search, '', $input);
                return $output;
}
                //define layout name
                $layoutName = 'SYSTEMS CONFIGURATOR';

                //block for pagination
                if(isset($_GET['page']) && !empty($_GET['page'])){
                                $page = $_GET['page'];
                }
                else{
                                $page = 1;
                }

                $max = "20";
                $skip = ($page - 1) *  $max;

                // grab their search query and clean it
                if($_POST){
                                $searchQuery    = $_POST['q'];
                                $_SESSION['searchQuery'] = $searchQuery;
                }
                else{
                                if(!isset($_SESSION['searchQuery'])){
                                                header('location: index.php');
                                }
                }
                //$searchQuery                = "amat";

                // sanitize
                $cleanInput = cleanInput($_SESSION['searchQuery']);

                // Add 1st request for serial number
                $findSerial = $fm->newFindRequest($layoutName);
                $findSerial->addFindCriterion('OEM Name', $cleanInput);


                // Add 2nd request for category
                $findDesc = $fm->newFindRequest($layoutName);
                $findDesc->addFindCriterion('Category', $cleanInput);
                // search the description field
                //$find->addFindCriterion('description', $cleanInput);

                // sort the results
                //do a compound find with above two search conditions
                $compoundFind = $fm->newCompoundFindCommand($layoutName);
                $compoundFind->add(1, $findSerial);
                $compoundFind->add(2, $findDesc);
                $compoundFind->addSortRule('Serial #', 1, FILEMAKER_SORT_ASCEND);

                // set skip and max values
                $compoundFind->setRange($skip, $max);

                // run the search
                $result = $compoundFind->execute();
                $records = $result->getRecords();

                //get found count and get total page number
                $foundCount = $result->getFoundSetCount();
                $totalPage = ceil($foundCount / $max);

                // create the smarty object
                $smarty = new Smarty();
                $smarty->force_compile = true;
                $smarty->debugging = false;
                $smarty->caching = false;
                //$smarty->cache_lifetime = 120;
?>
Russell Brackett
Web Developer

Capitol Area Technology
3500 Comsouth Suite 500
Austin, Texas, 78744
[email protected]<mailto:[email protected]>
Office 512-610-3246
Cell 979-412-3018

Capitol Area Technology:
Integrity-Courtesy-Customer Satisfaction
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.