Re: search array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 11, 2013 at 1:37 PM, Russell Brackett
<rbrackett@xxxxxxxxxxxxxx> wrote:
> 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
> rbrackett@xxxxxxxxxxxxxx<mailto:c.hall@xxxxxxxxxxxxxx>
> Office 512-610-3246
> Cell 979-412-3018
>
> Capitol Area Technology:
> Integrity-Courtesy-Customer Satisfaction
>

Where do these methods come from?

>                 // 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();

I'm not familiar with them as one of the usual PHP database extensions.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux