[FX.php List] Which is faster?

Bob Patin bob at patin.com
Sat Sep 11 13:57:16 MDT 2010


For some reason, I'm getting all records instead of the 3 that I've checked:

$_POST['recid'] is my checkbox...


$query =new FX($serverIP,$webCompanionPort);
$query->SetDBData($dbname_inv,'web');
$query->SetDBPassword($wpw,$un);
$query->SetLogicalOR();
// loop through the recid array and add the query
if(isset($_POST['recid']) && is_array($_POST['recid'])) {
	foreach($_POST['recid'] as $recid) {
		$query->AddDBParam('recid', $recid);
	}
}
$queryResult = $query->FMFind();

echo $queryResult['foundCount'];

Where's my error? :)


On Sep 11, 2010, at 2:27 PM, Leo R. Lundgren wrote:

> 
> 11 sep 2010 kl. 21.21 skrev Bob Patin:
> 
>> Very cool. I was going to use this:
>> 
>> <input type="checkbox" name="service<?php echo $counter; ?>">
> 
> If you do it this way, how are you going to know which posts to query the database for? All you have is a series of numbers not relating to the posts at all (assuming $counter is something that starts at 0 or something and is incremented for each record in page one).
> 
>> but you're right, I could use the RECID instead, like this:
>> 
>> <input type="checkbox" name="service[<?php echo $recid; ?>]">
> 
> Yeah, and if for some reason you cannot use the recId in the query when doing a composite/multi one, then use your own primary key in the table (a unique integer ID field for example).
> 
>> I'm not familiar with is_array; I assume that it looks at $_POST['service'], which is an array, and the array will only contain elements that are non-empty, is that right? So the unchecked boxes won't build the array?
> 
> No. See php.net/in_array ;)
> 
> -|
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100911/4a43f36c/attachment.html


More information about the FX.php_List mailing list