[FX.php List] Which is faster?

Leo R. Lundgren leo at finalresort.org
Sat Sep 11 13:27:49 MDT 2010


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 ;)

-|

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


More information about the FX.php_List mailing list