[FX.php List] Finding records based on an array of IDs

Steve Winter steve at bluecrocodile.co.nz
Mon Aug 13 10:10:18 MDT 2012


Bob

I'm confused… you want to search in DOCUMENTS (or whatever it's called, you didn't name it below) for 100 OR 101…?

So in pseudo SQL;

	SELECT * FROM Documents WHERE tourID IN (100, 101)

Is that correct…?

In which case won't

	$InstanceName = new FX(**server**);
	$InstanceName->SetDBData(**file**, **layout**);
	$InstanceName->AddDBParam('TourID',  100);
	$InstanceName->AddDBParam('TourID', 101);
	$InstanceName->AddDBParam('-lop', 'or');
	$ReturnedData = $InstanceName->FMFind(); 

Do what you want…?

Cheers
Steve

> I have a system where there are users in a USERS table; each USER has 1 or more related records in a 2nd table that we'll call TOURS.
> 
> In a 3rd table I have related documents that are uploaded to one of the tours for which this user *may* have access.
> 
> For example, let's say that I am a user, and I have 2 tours that I can access.
> 
> USER: bob
> 
> TOUR IDs: 100, 101
> 
> When I login, I create an array of all the tourIDs related to my user record; I store the array in a session variable
> 
> $_SESSION['tourIDs'][0] = 100
> $_SESSION['tourIDs'][1] = 101
> 
> I want to find a list of all documents that have one of these tourIDs in it.
> 
> QUESTION: How do I append my found set to include multiple tourIDs? The first idea I had was to create an array from the found records, and build my results that way; is there an easier way than that to extend a found set similar to the way that FileMaker does it?
> 
> Thanks,
> 
> 
> Bob Patin
> Longterm Solutions LLC
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> FileMaker 9, 10 & 11 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --
> Twitter: bobpatin
> Google+: http://www.longtermsolutions.com/plus
> AIM: longterm1954
> iChat: bobpatin
> --
> Expert FileMaker Consulting 
> FileMaker Hosting for all versions of FileMaker
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

Steve Winter
+44 777 852 4776
steve at bluecrocodile.co.nz






More information about the FX.php_List mailing list