If you’ve been looking at building custom PHP scripts to add records to your FileMaker database, you might have come across the following snippet from the Custom Web Publishing with PHP document:
There are two ways to create a record:
- Use the createRecord() method, specifying a layout name, and optionally specifying an array of field values. You can also set values individually in the new record object.The createRecord() method does not save the new record to the database. To save the record to the database, call the commit() method.
For example:
$rec =& $fm->createRecord('Form View', $values);
$result = $rec->commit();- Use the Add command. Use the newAddCommand() method to create a FileMaker_Command_Add object, specifying the layout name and an array with the record data. To save the record to the database, call the execute() method.
For example:
$newAdd =& $fm->newAddCommand('Respondent', $respondent_data);
$result = $newAdd->execute();
Which is somewhat helpful, but many people wonder what the substantive difference is between these two statements. Continue reading ‘FMPHP: The difference between createRecord() and newAddCommand()’



Recent Comments