[FX.php List] Query question
DC
dan.cynosure at dbmscan.com
Thu Jan 25 16:21:57 MST 2007
my advice... do the first query (city, state, zip). then take the FX
result and run it through a foreach() checking the catalog field for
your AB001,AB002 etc strings.
untested code:
$cat_num="AB001 AB002 AB003";
$arr= array();
foreach ($FX_RESULT_DATA as $rec) {
// check each record's catalog field
// assume one catalog entry per record (ie. not multiline)
// space at front allows us to rely on zero return value ==FALSE
if (strpos(' '. $cat_num, $rec['catalog'][0])) {
$arr[] = $rec['catalog'][0]; // add to new array
}
}
if you have a multiline catalog field you'll have to do some extra steps
to get the comparison right.
HTH,
dan
Bob Patin had written:
> I can't believe I've not had to do this type of search before:
>
> I need to search 5 or more fields; in one of the fields, I need to
> search for 1 or more different catalog numbers. So a search would be
> like this:
>
> CITY -- 1 value here
> STATE - 1 value here
> ZIP - 1 value here
> CATALOG NUMBER - could be a bunch of different cat. numbers
>
> I'd thought that I could just concatenate the catalog numbers like this:
>
> $cat_num=AB001 AB002 AB003 ... and so on
>
> and then search the catalog_number field using a single line
> AddDBParam('cat_num',$cact_num);
>
> But this doesn't work right. if I add an OR conditional, doesn't it
> apply to the whole query?
>
> How do I search for this:
>
> (these first 3 must match)
> Nashville
> TN
> 37211
>
> plus, it must contain 1 of these catalog numbers:
> AB001 or AB002
>
> I know this is simple, but I can't remember how this is done...
>
> Thanks,
>
> Bob Patin
> bob at patin.com
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list