Created
November 28, 2012 18:52
-
-
Save val360/4163213 to your computer and use it in GitHub Desktop.
Example, retrieving data from FileMaker container field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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