Sync Mnemosyne
Sync Mnemosyne

Reputation: 173

Filemaker via PHP

I am working on a php script that gets the values of the fields inside a Filemaker database. What I want to accomplish now is how do I edit/update the field values of each field to new values and should be saved in the Filemaker database. This is my code in getting the field:

require_once ('../../FileMaker.php');

$fm = new FileMaker('dataStest.fp7', 'https://secure.smartdecision.org', 'web', 'webtest');

$findCommand = $fm->newFindCommand('List');
$findCommand->addFindCriterion('ID1',$ftype); 
$result = $findCommand->execute();
$records = $result->getRecords();

foreach ($records as $record) {
if ($record->getField('ID3') == "ACTIVE" && $record->getField('ftyCat') == "treatment") {
echo $record->getField('d15'). '<br>';
}

If(FileMaker::isError($result)){
echo "Could not connect to the field";
}

Any suggestions would be very helpful. Thank you!

Upvotes: 3

Views: 1191

Answers (1)

Chuck
Chuck

Reputation: 4892

You just need to use the setField method as documented in the FileMaker PHP API (here's the page for the documentation on the FileMaker_Record class) and then commit your record with commit:

...
$record->setField('d15', 'new value');
$record->commit();
...

Upvotes: 4

Related Questions