July 5, 201213 yr $id = $_POST['familyid']; $rec = $fm->getRecordById('Family', $id); if (FileMaker::isError($rec)) { echo "Error :" .$rec->getMessage()."</br>"; exit; } $rec->setField('address', $_POST['addr'] ); $rec->setField('city', $_POST['city'] ); $rec->setField('s_last_name', $_POST['fslastname'] ); $rec->setField('s_gender', $_POST['fsgender'] ); $rec->commit(); The above php code that im using to insert the records to filemaker db from php pages... but some time record not properly stored to filemaker db.. (i have not included the db connection code here) please help me someone to solve this issue, or if possible share ur mind if you have any alternate idea.... or I need to do any changes with the above code. Many thanks in advance
July 5, 201213 yr The FileMaker internal Record ID is not necessarily going to be the same as the id field you have created, so getRecordById may not work in this instance. try // find the correct record $id = $_POST['familyid']; $getrec = $fm->newFindCommand('family'); $getrec->addFindCriterion('ID', $id); //This should be your table's ID field $found = $getrec->execute(); // get FileMaker's record ID $rec = $found->getRecords(); $recid = $rec[0]->getRecordId(); // edit record $change = newEditCommand('family', $recid); $change->setField('address', $_POST['addr'] ); $change->setField('city', $_POST['city'] ); $change->setField('s_last_name', $_POST['fslastname'] ); $change->setField('s_gender', $_POST['fsgender'] ); $result = $change->execute();
Create an account or sign in to comment