// 'foreach()' is a VERY handy function. It steps // through an array and stores the data in temporary // variables as directed ($key and $value in this case) if ($key != 'currentSort' && $key != 'currentQuery') { $BookQuery->AddDBParam($key, $value); // '$key' contains the name of the field to search in, } // '$value' contains the value we hope to find. $currentSearch .= '&' . "{$key}=" . urlencode($value); // The '.' and '.=' operators concatenate expressions } $BookData = $BookQuery->FMFind(); // This performs a find based on the specified parameters. } else { $currentSearch = ''; $BookData = $BookQuery->FMFindAll(); // Shows all records in the database } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>iViking FX -- Book List Demo Page</title> <style type="text/css"> <!-- .whitetxt {color: #FFFFFF} --> </style> </head> <body bgcolor="#FFFFFF">
/********************************************************************* * The comments herein are designed to be helpful to someone with * * little or no programming experience. To that end, many of the * * comments may address things will appear obvious to many coders. * * For the most part I'll place my comments at the end of each line. * * Feel free to e-mail any comments or questions to FX@iviking.org. * * Please remember that this code is being released as open source * * under The Artistic License of PERL fame... * * http://www.opensource.org/licenses/artistic-license.html * *...and is also covered by the FX.php license addendum... * * http://www.iviking.org/downloads/ADDENDUM.txt * *********************************************************************/ include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php"; // FX.php contains the class for pulling data // from FileMaker into PHP -- 'include_once()' // makes sure the class is only declared once. include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php"; // To make sure that these examples work for you, be sure // to set the IP address of your server in server_data.php // IMPORTANT: The leading '$' denotes a variable in PHP $DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType); // This line creates an instance of the FX class $DatasetQuery->SetDBData("Book_List.fp5", "Detail_View", 2); // The '->' indicates that SetDBData is part of // the FX instance we just created. $DatasetQuery->FMSkipRecords(2); $BookData = $DatasetQuery->FMFindAll(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head>
$HTTP_SESSION_VARS['editFields'] = serialize($editFields); } else { $editFields = unserialize($HTTP_SESSION_VARS['editFields']); foreach ($editFields as $key => $value) { if (is_array($formParams[$value])) { $formParams[$value] = implode("\n", $formParams[$value]); } $FXQuery->AddDBParam($value, $formParams[$value]); } $updateResult = $FXQuery->FMEdit(); // echo($updateResult['URL']); } } $FXQuery->SetDBData($FXE_currentDatabaseName, $FXE_currentLayoutName, $FXE_groupSize); $FXQuery->FMSkipREcords($skip); $ReturnedData = $FXQuery->FMFindAll(); // This demo finds all records in the current database. if ($FXE_currentLayoutName != '') { $fieldLayout = array(); $FXQuery->SetDBData($FXE_currentDatabaseName, $FXE_currentLayoutName); $viewData = $FXQuery->FMView(); // If a layout was specified, get the 'View' information for that layout. foreach ($viewData['fields'] as $key => $value) { if (!isset($value['valuelist'])) { $value['valuelist'] = ''; } $fieldLayout[$value['name']] = array('type' => $value['type'], 'valuelist' => $value['valuelist']); } } } else { $errorMessage = 'No valid Layout specified.';