Jump to content

searching within a found recordset


stevenm187

Recommended Posts

I have a found set of items that i wish to narrow down even further.

 

The products being displayed are accessories for trucks. I want to give the user the option to select their vehicle year make and model so that the items that are for that specific car will show, and everything else will be filtered out.

 

here is a visual example http://www.discounttruckaccessories.com/cilist.php?SubCategory2=Tailgate

 

For some reason when i choose the model make and year the error page displays claiming there are no records found. When I know for sure that there are records that meet the criteria.

 

here is the code for the form.

 

 

 

<form action="cinlist.php" method="get" id="nvehicle" name="nvehicle">
  <input type="hidden" value="<?php echo $sublist_row->getField('SubCategory2'); ?>" name="SubCategory2">
	<div>
<select id="pda-brand" >
					<option value="select">Select Make...</option>
					<option value="Dodge">Dodge</option>
			</select>


			  <select id="pda-type" name="pda-type" onchange='start_search()'>
			    <option class="select" value="select">Select type</option>
                    <?php foreach($dodge_result->getRecords() as $dodge_row){ ?>
			    <option class="Dodge" value="<?php echo $dodge_row->getField('id'); ?>"><?php echo $dodge_row->getField('id'); ?></option>
                    <?php } ?>
			    </select>
			  
        </div>
</form>

 

 

 

and here is the recordset

 

 

$cinlist_find = $Rackspace->newFindCommand('DTA INVENTORY');
$cinlist_findCriterions = array('SubCategory2'=>$_GET['SubCategory2'],'VehicleId'=>$_GET['pda-type'],);
foreach($cinlist_findCriterions as $key=>$value) {
    $cinlist_find->AddFindCriterion($key,$value);
}

 

can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/167675-searching-within-a-found-recordset/
Share on other sites

put in you where clause

 

AND year LIKE '{$year}' AND make LIKE  '{$make}' AND blah

 

if you use %%

 

AND year LIKE '%{$year}%' AND make LIKE  '%{$make}%' AND blah

 

then if year or make is '' noting then it wont effect the statment because everything is nothing yet nothing is everything ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.