[FX.php List] Which is faster?
Bob Patin
bob at patin.com
Sat Sep 11 13:02:20 MDT 2010
On Sep 11, 2010, at 1:48 PM, Leo R. Lundgren wrote:
> Isn't it possible to create one query (in page 2) like the equivalent of SQL's "select foo from bar where id=1 or id=3 or id=4"? I.e. building a query that asks for the IDs that were submitted in the form.
I haven't tried using the SetLogicalOR() command before; I'll give it a try.
So I'll just loop through my form POSTs, pulling recids and adding a line to my query for each returned recid; is that how you'd do it? Something like this:
$counter = $_POST['counter']; // this is the # of items that were on the previous form
// $_POST['service'] is the recid of the item that was checked
$query->SetLogicalOR();
while ($i <= $counter){
if strlen($_POST['service'])>0){
$query->AddDBParam('recid',$_POST['service']);
}
$i++;
}
$queryResult = $query->FMFind();
That would do it, wouldn't it?
BP
More information about the FX.php_List
mailing list