[FX.php List] Simple pagina example

Rheal Poirier rpoirier at advance.mb.ca
Thu Mar 24 10:06:59 MST 2005


I have a few problems with my PHP Code.
First and most important, I'm having issues with the link next and link 
previous links. If all records are shown the next and previous buttons 
work fine. If I do a search for certain criteria (example: 
manufacturer's name), then click the next link it returns no results 
(the url isn't correct)
If I do a search and then sort (using some links in the table headers), 
then click the next link all is good. (the url is good)
My second issue deals with the text that says which records are being 
shown (showing  8-14 of 20 records) The skip value doesn't seem to be 
functioning properly. Any help would be greatly appreciated.
Rheal


This is my current (half working) example
http://www.advance-pro.com/infocentre/clearance.php

Paired down info
-------------- next part --------------
Skipped content of type multipart/appledouble-------------- next part --------------



My code

include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php");
include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php");

$Item_Query = new FX($serverIP, $webCompanionPort);
$Group_Size = 7;															// # of records shown per page
$Item_Query->SetDBData("clearance_items.fp5", "general", 
$Group_Size);		// fileMaker file, layout, and #of records shown per page
$fmField = $_POST["fmfield"];												// field in form (for search 
by)
$fmValue = $_POST["fmvalue"];												// value in form (for search 
by)
$Item_Query->AddDBParam($fmField, $fmValue);  								// Search 
paramater (uses two previous fields in search)


$arrayName = 'HTTP_' . $_SERVER["REQUEST_METHOD"] . '_VARS';

if (isset($_REQUEST ['skip']) && $_REQUEST['skip'] > 0) {
      $Item_Query->FMSkipRecords($_REQUEST['skip']);
}

if (isset(${$arrayName}['currentSort']) && ${$arrayName}['currentSort'] 
!= '') {
     $Item_Query->AddSortParam($_GET['currentSort'], $_GET['sortOrder']);
}else{
$Item_Query->AddSortParam('date_added','descend',1);
}


if (isset(${$arrayName}['currentQuery']) && 
${$arrayName}['currentQuery'] == 'Find Items') {

	foreach (${$arrayName} as $key => $value) {
		if ($key == 'fmfield'){
	      $currentSearch .= "&" . urlencode($value);
	     }else
	       	if ($key == 'fmvalue'){
	   		$currentSearch .= "=" . urlencode($value);
	     } else
			if ($key != 'currentSort' && $key != 'currentQuery') {
			$Item_Query->AddDBParam($key, $value);
		}
	}
	foreach (${$arrayName} as $key => $value) {
		if ($key == 'currentSort'){
			$currentSearch = "";			
		} else
		if ($key == 'fmfield' || $key == 'fmvalue'){
		$currentSearch;
		}
		else{
		    $Item_Query->AddSortParam( $_GET['currentSort']);
		    $currentSearch .= '&' . $key ."=" . urlencode($value);
	    }
	}	
	$Item_Data = $Item_Query->FMFind();
} else {
     $currentSearch = '';
     $Item_Data = $Item_Query->FMFindAll();

}
?>


More information about the FX.php_List mailing list