2 Replies Latest reply on Aug 7, 2012 8:11 AM by hava

    Problems with record creation


      Hi, I am trying add new record to the FileMaker. I do

       public function save($table, $save_arr)
       $obj = $this->fm->createRecord($table, $save_arr);
      if (FileMaker::isError($obj)) { echo $obj->getErrorString(); } }

      but no record created no error. Whats happened and how can I debug it and check what it does?

        • 1. Re: Problems with record creation

          Hi hava,


          I assume you are using the FileMaker PHP API. I don't use the createRecord() method myself (I use the newAddCommand() method), but the general syntax for error checking is as follows:


          $result = $request->execute();


                                        if(FileMaker::isError($result)) {

                                  // FileMaker PHP API Error -- Alert User.

                                        $errorMessage = "Error Creating Service Provider Contact: " . $result->getMessage();

                                        } else {

             // continue



          Try changing:


          echo $obj->getErrorString();




          echo $obj->getMessage();


          and see if that works.


          You can check for any PHP errors in the web server/php log files. On Mac OS X you can look in the Console.app under  apache2>error.log, not sure about Windows. That can show you what the error is and point you in the right direction.




          • 2. Re: Problems with record creation

            ok, rebuilt to

                 public function save($table, $save_arr)
                      if( ! $this->get_row($table,array('key'=>'email', 'val'=>$save_arr['email'])))
                           $obj = $this->fm->newAddCommand($table, $save_arr);
                           if (FileMaker::isError($obj)) 
                                echo $obj->getMessage();
                           echo 'In DB';

            still nothing added

            $save_arr = Array
                [email] => joe@gmail.me
                [CreatedBy] => Web
                [ModififedBy] => Web
                [addr1] => Copperfield
                [business_name] => rrr
                [country] => UK
                [county] => Hampshire