本文整理汇总了PHP中FileMaker::getRecordById方法的典型用法代码示例。如果您正苦于以下问题:PHP FileMaker::getRecordById方法的具体用法?PHP FileMaker::getRecordById怎么用?PHP FileMaker::getRecordById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMaker
的用法示例。
在下文中一共展示了FileMaker::getRecordById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fmGetContainer
//.........这里部分代码省略.........
// ---> field = Resource(1)
// Note that we're most interested in the database name, which we need in order to
// determine the database connection info to use should we need to refer back to
// the record that the container was pulled from.
$container_info = html_entity_decode($container_field_array[1]);
$container_info = fmsubstitute($container_info, '-db', 'db');
$container_info = fmsubstitute($container_info, '&-', '&');
parse_str($container_info);
// fmDump ( $db, TRUE, 'db' );
// If the container contents file is available...
if (file_exists($physical_path_container_contents_file)) {
// Read the file.
$container_data = @file_get_contents($physical_path_container_contents_file);
} else {
// Using the database name, find the database connection to use...
foreach ($fm_databases as $fm_database) {
// If the connection was found...
if ($fm_database['database'] == $db) {
// Create a connection to the database.
$fm = new FileMaker();
$fm->setProperty('hostspec', $fm_database['hostspec']);
$fm->setProperty('database', $fm_database['database']);
$fm->setProperty('username', $fm_database['username']);
$fm->setProperty('password', $fm_database['password']);
break;
}
}
if (!isset($fm)) {
// Return control to the 404 error handler.
return;
}
// fmDump ( $fm, TRUE, 'fm' );
// Get the record that the container was pulled from.
$container_record = $fm->getRecordById($lay, $recid);
// fmDump ( $container_record, TRUE, 'container_record' );
// Get the container data.
$container_data = $fm->getContainerData($container_field_as_text);
if (FileMaker::isError($container_data)) {
die;
}
// fmDump ( $container_data, FALSE, 'container_data' );
// Save the container's contents on the server.
@file_put_contents($physical_path_container_contents_file, $container_data);
}
// If we have the container's content...
if (isset($container_data)) {
// Update the http response header, so that this does not appear to be a "404."
header('Status: 200', TRUE, 200);
// Explode the filename to get the extension.
$filename_parts = explode('.', $filename);
$extension = $filename_parts[1];
// If the extension includes a URL request...
if (fmPatternCount($extension, '?')) {
$extension_parts = explode('?', $extension);
$extension = $extension_parts[0];
}
// Setup the headers to use, based on the file type (extension).
switch ($extension) {
case 'gif':
header('Content-type: image/gif');
header('Content-Disposition: filename="' . $filename . '"');
break;
case 'jpeg':
header('Content-type: image/jpeg');
header('Content-Disposition: filename="' . $filename . '"');
break;
示例2: testGetRecordById
/**
* @covers \airmoi\FileMaker\FileMaker::getRecordById
* @depends testCreateRecord
*/
public function testGetRecordById($recId)
{
$record = $this->fm->getRecordById('sample', $recId);
if (!$GLOBALS['OFFICIAL_API']) {
$this->assertInstanceOf(Object\Record::class, $record);
} else {
$this->assertInstanceOf(\FileMaker_Record::class, $record);
}
$this->assertStringEndsWith('testCreateRecord', $record->getField('text_field'));
$this->fm->newDeleteCommand('sample', $record->getRecordId())->execute();
}
示例3: FileMaker
?>
<title>
<?php
if (array_key_exists('recid', $_GET)) {
// 'recid' parameter was passed in, use it to grab record object
// Create a new connection to FMPHP_Sample database.
// Location of FileMaker Server is assumed to be on the same machine,
// thus we assume hostspec is api default of 'http://localhost' as specified
// in filemaker-api.php.
// If FMSA web server is on another machine, specify 'hostspec' as follows:
// $fm = new FileMaker('FMPHP_Sample', 'http://10.0.0.1');
$fm = new FileMaker('FMPHP_Sample');
// Since we're passed in recid via param (i.e. viewRecord.php?recid=n), use
// FileMaker::getRecordById() to directly get record object with recid accessed
// via $_GET[] array
$record = $fm->getRecordById('Form View', $_GET['recid']);
if (FileMaker::isError($record)) {
echo "Error: {$result->getMessage()}\n";
exit;
}
echo "Editing " . $record->getField('Title');
} else {
// no 'recid', so we're creating a new record
?>
Create New Record
<?php
}
?>
</title>
<!-- declare charset as UTF-8 -->
示例4: elseif
}
if (strlen($value) > 0) {
$record->setField($fieldname, $value);
} elseif (strlen($record->getField($fieldname)) > 0) {
$record->setField($fieldname, null);
}
}
return $result;
}
// declare $rec
$rec = null;
// check to see that user didn't hit 'cancel' button
if (!array_key_exists('cancel', $_POST)) {
// Check for recid parameter which determines if this is a create new or edit
if (array_key_exists('recid', $_POST)) {
$rec = $fm->getRecordById('Form View', $_POST['recid']);
} else {
$rec =& $fm->createRecord('Form View', $values);
}
if (FileMaker::isError($result)) {
echo 'Record addition failed: (' . $result->getCode() . ') ' . $result->getMessage() . "\n";
exit;
}
// set field data from form data
setFieldData($rec);
// commit record to database
$result = $rec->commit();
if (FileMaker::isError($result)) {
echo 'Record addition failed: (' . $result->getCode() . ') ' . $result->getMessage() . "\n";
exit;
}