[FX.php List] Finding multiple records from multiple values forsame field

Bob Patin bob at patin.com
Mon May 12 08:22:19 MDT 2008


Roger,

It's working fine for me here.

In the web app that I'm building, users can compare several records  
from the current found set, by clicking checkboxes for the desired  
records. The query will then find the selected records and display  
this constrained set using this query:

So I wrote this, and it's working fine:

$query=new FX($serverIP,$webCompanionPort);
	$query->SetDBData($dbname,$table_name,'all');
	$query->SetDBPassword($webpw,$webun);
	$query->AddSortParam('manufacturer','ascend');
	$query->AddSortParam('product','ascend');
	$num_records = $_POST['num_records']; // $num_records is the previous  
foundCount for the found set they were viewing
	
	// loop thru the last found set, retrieve all the checkbox values
	// if it's checked, add its line to the query
	$x = 0;
	while ($x<($num_records+1)){
		if(strlen($_POST['c_'.$x])>0){
			$query->AddDBParam('recid',$_POST['c_'.$x]);
		}
	$x++;
	}
	
	$query->SetLogicalOR();
	$queryResult=$query->FMFind();

Hope this helps,

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
FileMaker 9 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060

--------------------------
Contact us for FileMaker hosting and programming for all versions of  
FileMaker
PHP • CDML • Full email services • Free DNS hosting • Colocation •  
Consulting


On May 12, 2008, at 2:54 AM, Roger Price wrote:

> This is something that I have tried (and failed) to do previously.   
> It has been my understanding that even using SetLogicalOR()  you  
> cannot query the same field more than once so that the following  
> does not work:
>
> $query->AddDBParam('fieldname', 'something',       'eq');
> $query->AddDBParam('fieldname', 'somethingelse','eq');
>
> When I have done this only the 'somethingelse' value seems to be  
> returned!
>
> Roger
>
>
> --------------------------------------------------
> From: "Tim 'Webko' Booth" <tim at nicheit.com.au>
> Sent: Monday, May 12, 2008 1:11 AM
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Subject: Re: [FX.php List] Finding multiple records from multiple  
> values forsame field
>
>>
>> On 10/05/2008, at 6:26 AM, Bob Patin wrote:
>>
>>> Just found the answer, the SetLogicalOR();
>>
>> From experience, if you do this, you cannot use an AND search in  
>> the  same query...
>>
>> Cheers
>>
>> Webko
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> _______________________________________________
> 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