本文整理汇总了PHP中FileMaker::createRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP FileMaker::createRecord方法的具体用法?PHP FileMaker::createRecord怎么用?PHP FileMaker::createRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMaker
的用法示例。
在下文中一共展示了FileMaker::createRecord方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateRecord
/**
* @covers \airmoi\FileMaker\FileMaker::createRecord
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function testCreateRecord()
{
$record = $this->fm->createRecord('sample', ['text_field' => __METHOD__]);
if (!$GLOBALS['OFFICIAL_API']) {
$this->assertInstanceOf(Object\Record::class, $record);
} else {
$this->assertInstanceOf(\FileMaker_Record::class, $record);
}
$result = $record->commit();
$this->assertTrue($result);
return $record->getRecordId();
}
示例2: elseif
$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;
}
}
// set Location: HTTP header to force redirect