[FX.php List] FMSkipRecords

Chris Hansen chris at iViking.org
Mon Mar 27 09:51:01 MST 2006


Jonathan,

At least part of your problem is that you're mixing the $_GET and  
$_POST arrays on a page, even though usually only one will contain  
data.  For example:

1) if someone clicks your skip links, the data will be sent via GET  
(so elements of the $_POST array will be empty)
2) you're pulling data from $_POST['skip'] which would never be  
populated per (1) above

I suspect that there's a dynamic search form and you then want to  
allow users to browse through paged records.  If that's the case,  
here are a couple of pointers:

1) Use sessions or hidden inputs to keep track of the current search  
parameters.  Basically, the solution will need some way to track what  
the current search is for each user between pages, since your search  
parameters will not automatically be resent.

2) You might consider changing your link so that it submits a form,  
rather than linking to another page.  That way could could keep track  
of the search parameters as hidden elements, always submit the page  
via POST (since the form method is specified in the form tag), but  
still retain the style of your interface.

HTH

--Chris Hansen
   FileMaker 7 Certified Developer
   Creator of FX.php
   "The best way from FileMaker to the Web."
   www.iViking.org


On Mar 24, 2006, at 12:25 PM, Jonathan Foerster wrote:

> Hello!
>
> I am trying to get the FMSkipRecords function to work.  The code  
> below fails to return any records (when there should be several  
> pages worth).
>
> I have stolen much of this code, trying to get something to work  
> (thanks to you, if you unwittingly contributed).  Thanks!
>
> Jonathan Foerster
>
> <?php
> include_once('FX/FX.php');
> include_once('FX/server_data.php');
>
> $Title=$_POST['Title'];
> $Author=$_POST['Author'];
> $Year=$_POST['Year'];
> $Department=$_POST['Department'];
> $Keywords=$_POST['Keywords'];
> $Advisor=$_POST['Advisor'];
> $Records=$_POST['Records'];
> $Sort=$_POST['Sort'];
> $Classification=$_POST['Classification'];
>
> if(isset($_POST['skip'])){ $skipSize=$_POST['skip'];}else 
> {$skipSize='5';}
>
> $search=new FX($serverIP,$webCompanionPort);
> $search->SetDBData('FieldStudies.fp7','Entry', $Records);
> $search->SetDBPassword($webPW,$webUN);
> $search->AddDBParam('Title',$Title,$operator);
> $search->AddDBParam('Author',$Author,$operator2);
> $search->AddDBParam('Year',$Year,$operator3);
> $search->AddDBParam('Department',$Department);
> $search->AddDBParam('Description',$Keywords,$operator4);
> $search->AddDBParam('Advisor',$Advisor,$operator5);
> $search->AddDBParam('Type',$Classification);
> $search->AddSortParam($Sort,'ascend');
> $search->FMSkipRecords($skipSize);
> $searchResult=$search->FMFind();
> ?>
>
>
> <table>
> <tr>
> <td>
> <?php
> if (strlen($searchResult['linkPrevious']) < 1) {
> ?>
> &laquo;- Previous
> <?php
> } else {
> ?>
> <a href="?skip=<?php echo($skipSize) ?>"><strong>&laquo;- Previous</ 
> strong></a>
> <?php
> }
> ?>
> </td>
> <td>
> <?php
> if (strlen($searchResult['linkNext']) < 1) {
> ?>
> Next -&raquo;
> <?php
> } else {
> ?>
> <a href="?skip=<?php echo($skipSize) ?>"><strong>Next -&raquo;</ 
> strong></a>
> <?php
> }
> ?>
> </td>
> </tr>
> </table>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



More information about the FX.php_List mailing list