AnsweredAssumed Answered

PHP Page find record, modify field

Question asked by Tom_Droz on Oct 11, 2017
Latest reply on Oct 11, 2017 by bhamm@mac.com

I am trying to do something that should be simple, but am stuck.  Any help on what is wrong here?  I am trying to find a record and set a field to a value.  To simplify I am providing the 2 variables.

It stops on the:

$rec->setField ('Photo_Count', $Count);   //Set Field Name to supplied variable$rec->setField

 

This step is wrong, but not sure how I find a record then edit it?  The examples I see are with a record ID, not a found record

 

Any thoughts?

Thanks in advance

Tom

 

 

<?php
require_once('FileMaker.php');

$fm = new FileMaker();
$fm->setProperty ('database', 'xxxx');
$fm->setProperty ('hostspec', 'xxxx');
$fm->setProperty ('username', 'xxxxx');
$fm->setProperty ('password', 'xxxx');

 

  

  $StockNumber = 1000;
  $Count= 55;

 

    #start the find
    $find= $fm->newFindCommand ("Scripted_PhotoCount");    //Layout Name

    $find->addFindCriterion('__kp_Stock Number','=='.$StockNumber);  //Fieldname exact match to supplied variable

    $result = $find->execute();    // Execute above Find

$rec->setField ('Photo_Count', $Count);   //Set Field Name to supplied variable

$result = $rec-> commit(); // Commit Record

?>

Outcomes