4 Replies Latest reply on Dec 30, 2013 4:19 PM by Tom_Droz

    PHP create record


      Hi all


      I use dreamweaver with FM plug in. I have used this exact script before with no problems. I am now trying it on a differnt database all FM12. The PHP script correctly creates a new record. However when I look for the record it doesnt show. If I close the database and reopen it it is there. Why is the record not committing? Any ideas.







      <?php require_once('Connections/Faith.php'); ?>
      $FormAction_add = $Faith->newAddCommand('Temp_Web_Showings');
      $FormAction_fields = array
      'ID'=>$_REQUEST['ID'] );


      foreach($FormAction_fields as $key=>$value) {

      $FormAction_result = $FormAction_add->execute();

      if(FileMaker::isError($FormAction_result)) fmsTrapError($FormAction_result,"error.php");

      $FormAction_row = current($FormAction_result->getRecords());
      // FMStudio v1.0 - do not remove comment, needed for DreamWeaver support ?>

        • 1. Re: PHP create record

          Couple of thoughts:


          require_once('filemaker.php'); /// is no where to be found... Perhaps the Faith.php document calls it.


          What does the script "Temp_Show" do?


          I assume $Faith is defined in the Faith.php documet too...?


          Generally there is a delay between execute() and the result showing in the database.


          - Lyndsay

          • 2. Re: PHP create record

            Hi Lynday


            Thank you for giving this some thought.  The required once, as you suggest is all covered in the Faith.php.  I have used that exact configuration many times with out ever a hitch.


            The script mention right now does nothing it is just a place holder for sending an email notification once the record is created.


            As I mention, when i run this script from the website then go to the database, no record shows.  I waited 10 + minutes (In the past it is instantaneous on other databases).


            If I log out of the file and log back in, even if I wait only a moment, the record then shows.  If I run the script from the web page multiple times, no records show until I sign out then back in.


            The first step calls for a new record.  It would seem that record is instanly committed even if there is no field data.  Why it dosent show without a log out/log in, is a puzzle!



            • 3. Re: PHP create record

              What about this bit:

              if(FileMaker::isError($FormAction_result)) fmsTrapError($FormAction_result,"error.php");


              I'm not familiar with that syntax...

              It is not opened with { nor closed with } like this:

              if(FileMaker::isError($FormAction_result)){ fmsTrapError($FormAction_result,"error.php"); }


              Have you tried hiding the script? Perhaps being empty it is not sure what to do so you might have some sort of time-out.


              When I want to force the data to show in FMP, I change layouts then go back or click previous record... never more than that...


              I am assuming your form only has one value for each $_REQUEST()...? So I am therefore wondering why the foreach was necessary...?


              When you look at the record created, are all the form values entered?


              - Lyndsay

              1 of 1 people found this helpful
              • 4. Re: PHP create record

                Thanks again Lyndsay


                I removed the run script step and things worked, so the problem is resolved