Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@val360
Created November 28, 2012 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save val360/4163213 to your computer and use it in GitHub Desktop.
Save val360/4163213 to your computer and use it in GitHub Desktop.
Example, retrieving data from FileMaker container field
<?php
require_once ('FileMaker.php');
define ('FM_HOST', 'XXX.XXX.XXX.XXX');
define ('FM_FILE', 'file.fmp12');
define ('FM_USER', 'user');
define ('FM_PASS', 'pass');
$fm = & new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
checkError($fm);
$id = $_REQUEST['id'];
if (empty($id)) {
die("Invalid id");
}
$record = $fm->getRecordById("NHP Documents", $id);
checkError($record);
echo "found the record";
$container = $record->getField("CONT: Document");
checkError($container);
echo "got a container ref.";
$data = $fm->getContainerData($container);
checkError($data);
echo "Fetched data";
exit;
function checkError($result)
{
if( $result instanceof FileMaker_Error )
{
die( "<p>Error: " . $result->getMessage() . "</p>" );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment