[FX.php List] LinkNext - seriously, hands in the air...

Brion Vibber brion at pobox.com
Sat Oct 16 16:50:44 MDT 2004


On Oct 12, 2004, at 7:41 AM, Ben Rollins wrote:
> The code is below - can anyone tell me why the Skip breaks the page?

You're making a method call on an array, which results in a PHP fatal 
error. If your server is set not to log or display error messages, 
it'll just die at that point with no explanation... PHP is so helpful 
this way. :)

Instead you need to run FMSkipRecords() on the FX object before calling 
FMFind(), so it knows which records to fetch.

> $search_result = new FX($serverIP,$webCompanionPort);
> $groupSize = 10;
> $search_result->SetDBData('Members.fp5','cgi', $groupSize);

add here:
if (isset($_REQUEST['skip'] && $_REQUEST['skip'] > 0) {
     $search_result->FMSkipRecords(IntVal($_REQUEST['skip']));
}

(I suggest adding an IntVal() here as a general defensive programming 
practice; input from the web can't be trusted. Consider running 
htmlspecialchars() on output such as the link as well.)

> $result = $search_result->FMFind();

then remove this bit:
> if (isset($_REQUEST['skip']) && $_REQUEST['skip'] > 0) {
>      $result->FMSkipRecords($_REQUEST['skip']);
> 	 }

-- brion vibber (brion @ pobox.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20041016/a1c481eb/PGP.bin


More information about the FX.php_List mailing list