Sign in to follow this  
Followers 0
VickyLNesbitt

Perpetually creating blank records

7 posts in this topic

Hi All

 

I am experiencing a very odd problem with a web form we created for our clients.

 

The web form worked absolutely perfectly on the Apache server we started the clients off on. We're now trying to move them to a new IIS server on a much more powerful machine, however there have been some issues. On entry of the first page a record is created in the database & when the form is posted, that record is edited & continues to be edited on subsequent form pages after filemaker's record ID and the primary key are stored as session variables. NOTE: There is an included page prior to the code I have entered below which sets $ID & $recordID to the value of the session variables for the ID's.

 

A few items of code had to be re-written & these elements now work fine, however I have just noticed a new problem & I have no idea how it is happening...

 

The first step on the first page is to test for the existence of 2 variables. If these variables do not exist a record is created in the database and the 2 variables are set (see below).

if (!isset($ID) AND !isset($recordID)){

	$stepTwoEdit = $fm->newAddCommand('webCandidateFormStepTwo'); 
	$result = $stepTwoEdit->execute();	
	if (FileMaker::isError($result)){
		echo $result->code;
		die();
	}			
	$record=$result->getRecords();
	$recordID=$record[0]->getRecordId();
	$ID=$record[0]->getField('ID');
	session_start();
	$_SESSION['recordID']=$recordID;
	$_SESSION['ID']=$ID;
	session_write_close();
		
}//if record has not yet been created in the database create it so that we have an id

Now this code works perfectly. I have echo-ed the variables onto the page and they are being set correctly & I have done tests to verify that the newAddCommand is only being performed once by echo-ing text inside the if statement.

 

So it appears to all be working correctly, until you go and look in FileMaker.

 

Blank records are being continuously created by the server, despite the fact that the newAddCommand is not being repeated. This command is called once and only once. These records are not just created on page refreshes or on navigation between form pages - they just keep being created every x seconds (there's no consistent interval)...

 

Any ideas?!? Really need to get these clients onto our new server asap, so help would be massively appreciated!

 

Thanks in advance!

 

x

Share this post


Link to post
Share on other sites

The code shown appears correct.  Copy this snippet to a new test file (with the proper FM access prefix) to confirm.

 

The next place to look is if the If() statement shown is inside a loop, or if the entire PHP script is being called repeatedly by another script.

Share this post


Link to post
Share on other sites

Or if Clients are just hitting Refresh in their browsers...

 

Personally, I'd start the session at the beginning of the page and test for the session variables...

 

Cheers

Webko

Share this post


Link to post
Share on other sites

Hi Guys

 

Thanks for your responses!

 

doughemi - I think that's my next step - to start picking out bits of codes and run them separately to try an identify what the problem is.

 

There is no looping anywhere on the page except when I'm picking up value lists much further on in the code & there's definitely nothing else triggering this...

 

webko - refreshing should not be an issue - even if the user refreshes the page the session variable has already been created therefore that if won't validate to true and the newAddCommand won't execute. I've tested this by echoing text inside the if statement - on page entry the text is there, but when I refresh it's not as the session variables have been made and the if does not validate to true. Also the session is started at the beginning of the page - aside from connecting to the DB & a couple of other miscellaneous bits.

 

The weird thing is that on the first page load I can literally sit and watch blank records slowly being added to the database even if I don't refresh the page, it just slowly starts creating the records and does not stop! It's nuts!

 

Vicky

 

x

Share this post


Link to post
Share on other sites

Do you have a redirect anywhere on the page?

 

I've managed to create a loop between two pages that redirected to each other before...

Share this post


Link to post
Share on other sites

Hurrah! Finally gotten round to having another stab at this... And I've only gone and fixed it!

 

Default document for the site with the form on was set to the first page of my form where the record was being created....

 

I changed the default document to a blank html page and BOOM - problem solved.

 

Thanks for your help guys!

Share this post


Link to post
Share on other sites

Ah... that would indeed do it ;-)

 

Good catch

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By randyinla
      Hi, I have a field called 'mytournament1'.  I also have a field called 'mytournament1played'.  With a form, I create the variable $tournament to bring 'mytournament1' to my results page.
      $tournament = $_GET['tournament'];
      I'd like to force the results page to search for the field 'mytournament1played' for each record by using the variable $tournament and combining the word 'played' or the variable $played.  
      $played = 'played';
      $tournamentplayed = $tournament . $played;
      $tournamentplayed2 = $record->getField('$tournamentplayed');
      (I want it to deliver)      $record->getField('mytournament1played');

      I know the 1st '$record->getField' line is wrong.  Can I combine 2 variables that spell out a database field name (mytournament1played) that can be used to call up a field in a search?  i.e.
      if ($tournamentplayed2!='1') {

      thanks in advance for your help!
       
    • By sal88
      Hi all
      We have a web based tickets portal which creates new messages in our filemaker database - this is for customers' use. It does this using the PHP API (the website was developed by a third party). We would like the owners of tickets to be notified when the customer has added a message to one of the tickets that they are in charge of.
      Is there a way for filemaker/filemaker server to trigger a 'send email' script when a new record is created via the web portal? Or would it be simpler for this action to occur on the web side?
      Many thanks
    • By bwalsh
      Hi, I am relatively new to FileMaker. I am a PHP developer currently working on a project that involves the FMS custom web publishing PHP API. I was able to successfully connect using the API, but the connection is no longer working. The error message says only "Unable to open file". My research says that this could be due to the database file not being open, or to a permissions issue.

      I can see in the FMS admin console that the database file is open, with "normal" status. The FMWEBDIRECT and PHP columns both have full circles, indicating that the database should be accessible through the PHP API. Both the web server and the web publishing engine are on, with green checks, and PHP is activated.

      I am using the same username and password that worked previously. I checked again in the database security settings and confirmed that the username and password are still correct and that the user account has the "fmphp" privelege. What else should I look for?
      In the web publishing error log I see entries that say:
       
      127.0.0.1:63876 [USERNAME] - 802 563 "fmi/sml/fmresultset.xml?-db=[DB]&-lay=[LAYOUT]&-findany" Does the PHP API use the XML API? Also, here is the full var_dump() of the error object:

       
      object(FileMaker_Error)#6 (9) { ["_fm"]=> &object(FileMaker_Implementation)#2 (3) { ["V73ee434e"]=> array(9) { ["charset"]=> string(5) "UTF-8" ["locale"]=> string(2) "en" ["logLevel"]=> int(3) ["hostspec"]=> string(16) "http://127.0.0.1" ["recordClass"]=> string(16) "FileMaker_Record" ["prevalidate"]=> bool(false) ["database"]=> string(11) "DD_Personal" ["username"]=> string(14) "xxxx" ["password"]=> string(12) "xxxx" } ["Vea4b3413"]=> NULL ["V9a3dcbce"]=> NULL } ["error_message_prefix"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> string(3) "802" ["message"]=> NULL ["userinfo"]=> NULL ["backtrace"]=> array(7) { [0]=> array(6) { ["file"]=> string(90) "/Library/FileMaker Server/Web Publishing/publishing-engine/php/el capitan/lib/php/PEAR.php" ["line"]=> int(945) ["function"]=> string(11) "__construct" ["class"]=> string(10) "PEAR_Error" ["type"]=> string(2) "->" ["args"]=> array(5) { [0]=> NULL [1]=> string(3) "802" [2]=> NULL [3]=> NULL [4]=> NULL } } [1]=> array(7) { ["file"]=> string(101) "/Library/FileMaker Server/Web Publishing/publishing-engine/php/el capitan/lib/php/FileMaker/Error.php" ["line"]=> int(52) ["function"]=> string(10) "PEAR_Error" ["class"]=> string(10) "PEAR_Error" ["object"]=> *RECURSION* ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> NULL [1]=> string(3) "802" } } [2]=> array(7) { ["file"]=> string(129) "/Library/FileMaker Server/Web Publishing/publishing-engine/php/el capitan/lib/php/FileMaker/Implementation/Parser/FMResultSet.php" ["line"]=> int(48) ["function"]=> string(15) "FileMaker_Error" ["class"]=> string(15) "FileMaker_Error" ["object"]=> *RECURSION* ["type"]=> string(2) "->" ["args"]=> array(3) { [0]=> &object(FileMaker_Implementation)#2 (3) { ["V73ee434e"]=> array(9) { ["charset"]=> string(5) "UTF-8" ["locale"]=> string(2) "en" ["logLevel"]=> int(3) ["hostspec"]=> string(16) "http://127.0.0.1" ["recordClass"]=> string(16) "FileMaker_Record" ["prevalidate"]=> bool(false) ["database"]=> string(11) "DD_Personal" ["username"]=> string(14) "xxxx" ["password"]=> string(12) "xxxx" } ["Vea4b3413"]=> NULL ["V9a3dcbce"]=> NULL } [1]=> NULL [2]=> string(3) "802" } } [3]=> array(7) { ["file"]=> string(122) "/Library/FileMaker Server/Web Publishing/publishing-engine/php/el capitan/lib/php/FileMaker/Implementation/CommandImpl.php" ["line"]=> int(84) ["function"]=> string(5) "parse" ["class"]=> string(28) "FileMaker_Parser_FMResultSet" ["object"]=> object(FileMaker_Parser_FMResultSet)#5 (17) { ["Vcb5e100e"]=> string(3) "802" ["Vf5bf48aa"]=> array(3) { ["build"]=> string(10) "10/27/2016" ["name"]=> string(31) "FileMaker Web Publishing Engine" ["version"]=> string(10) "15.0.3.308" } ["V1ea7e575"]=> array(7) { ["database"]=> string(0) "" ["date-format"]=> string(0) "" ["layout"]=> string(0) "" ["table"]=> string(0) "" ["time-format"]=> string(0) "" ["timestamp-format"]=> string(0) "" ["total-count"]=> string(1) "0" } ["V9f81f3c0"]=> array(0) { } ["Vaae0d98d"]=> array(2) { ["count"]=> string(1) "0" ["fetch-size"]=> string(1) "0" } ["Vae581270"]=> array(0) { } ["V6e52c40b"]=> array(0) { } ["Ve13f1c92"]=> NULL ["V43432a31"]=> NULL ["V51bc3e3b"]=> NULL ["V26005321"]=> NULL ["V6468d939"]=> NULL ["_fm"]=> &object(FileMaker_Implementation)#2 (3) { ["V73ee434e"]=> array(9) { ["charset"]=> string(5) "UTF-8" ["locale"]=> string(2) "en" ["logLevel"]=> int(3) ["hostspec"]=> string(16) "http://127.0.0.1" ["recordClass"]=> string(16) "FileMaker_Record" ["prevalidate"]=> bool(false) ["database"]=> string(11) "DD_Personal" ["username"]=> string(14) "xxxx" ["password"]=> string(12) "xxxx" } ["Vea4b3413"]=> NULL ["V9a3dcbce"]=> NULL } ["V5431b8d4"]=> resource(28) of type (Unknown) ["V6de51026"]=> bool(false) ["_result"]=> NULL ["_layout"]=> NULL } ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> string(563) "" } } [4]=> array(7) { ["file"]=> string(130) "/Library/FileMaker Server/Web Publishing/publishing-engine/php/el capitan/lib/php/FileMaker/Implementation/Command/FindAnyImpl.php" ["line"]=> int(17) ["function"]=> string(10) "_getResult" ["class"]=> string(32) "FileMaker_Command_Implementation" ["object"]=> object(FileMaker_Command_FindAny_Implementation)#4 (19) { ["_findCriteria"]=> array(0) { } ["Vd65662c5"]=> array(0) { } ["Va9136a07"]=> array(0) { } ["Vf951bdce"]=> NULL ["V83f28691"]=> NULL ["V85fd701e"]=> NULL ["V6da136ea"]=> NULL ["V568aa2ec"]=> NULL ["_fm"]=> &object(FileMaker_Implementation)#2 (3) { ["V73ee434e"]=> array(9) { ["charset"]=> string(5) "UTF-8" ["locale"]=> string(2) "en" ["logLevel"]=> int(3) ["hostspec"]=> string(16) "http://127.0.0.1" ["recordClass"]=> string(16) "FileMaker_Record" ["prevalidate"]=> bool(false) ["database"]=> string(11) "DD_Personal" ["username"]=> string(14) "xxxx" ["password"]=> string(12) "xxxx" } ["Vea4b3413"]=> NULL ["V9a3dcbce"]=> NULL } ["_layout"]=> string(23) "BW Newsletter2Go Import" ["V7a2db0ea"]=> NULL ["_script"]=> NULL ["_scriptParams"]=> NULL ["_preReqScript"]=> NULL ["_preReqScriptParams"]=> NULL ["_preSortScript"]=> NULL ["_preSortScriptParams"]=> NULL ["V0b9a204c"]=> string(16) "FileMaker_Record" ["_recordId"]=> NULL } ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> string(563) "" } } [5]=> array(7) { ["file"]=> string(103) "/Library/FileMaker Server/Web Publishing/publishing-engine/php/el capitan/lib/php/FileMaker/Command.php" ["line"]=> int(137) ["function"]=> string(7) "execute" ["class"]=> string(40) "FileMaker_Command_FindAny_Implementation" ["object"]=> object(FileMaker_Command_FindAny_Implementation)#4 (19) { ["_findCriteria"]=> array(0) { } ["Vd65662c5"]=> array(0) { } ["Va9136a07"]=> array(0) { } ["Vf951bdce"]=> NULL ["V83f28691"]=> NULL ["V85fd701e"]=> NULL ["V6da136ea"]=> NULL ["V568aa2ec"]=> NULL ["_fm"]=> &object(FileMaker_Implementation)#2 (3) { ["V73ee434e"]=> array(9) { ["charset"]=> string(5) "UTF-8" ["locale"]=> string(2) "en" ["logLevel"]=> int(3) ["hostspec"]=> string(16) "http://127.0.0.1" ["recordClass"]=> string(16) "FileMaker_Record" ["prevalidate"]=> bool(false) ["database"]=> string(11) "DD_Personal" ["username"]=> string(14) "xxxx" ["password"]=> string(12) "xxxx" } ["Vea4b3413"]=> NULL ["V9a3dcbce"]=> NULL } ["_layout"]=> string(23) "BW Newsletter2Go Import" ["V7a2db0ea"]=> NULL ["_script"]=> NULL ["_scriptParams"]=> NULL ["_preReqScript"]=> NULL ["_preReqScriptParams"]=> NULL ["_preSortScript"]=> NULL ["_preSortScriptParams"]=> NULL ["V0b9a204c"]=> string(16) "FileMaker_Record" ["_recordId"]=> NULL } ["type"]=> string(2) "->" ["args"]=> array(0) { } } [6]=> array(7) { ["file"]=> string(64) "/Library/FileMaker Server/HTTPServer/htdocs/newsletter/index.php" ["line"]=> int(32) ["function"]=> string(7) "execute" ["class"]=> string(17) "FileMaker_Command" ["object"]=> object(FileMaker_Command_FindAny)#3 (1) { ["_impl"]=> object(FileMaker_Command_FindAny_Implementation)#4 (19) { ["_findCriteria"]=> array(0) { } ["Vd65662c5"]=> array(0) { } ["Va9136a07"]=> array(0) { } ["Vf951bdce"]=> NULL ["V83f28691"]=> NULL ["V85fd701e"]=> NULL ["V6da136ea"]=> NULL ["V568aa2ec"]=> NULL ["_fm"]=> &object(FileMaker_Implementation)#2 (3) { ["V73ee434e"]=> array(9) { ["charset"]=> string(5) "UTF-8" ["locale"]=> string(2) "en" ["logLevel"]=> int(3) ["hostspec"]=> string(16) "http://127.0.0.1" ["recordClass"]=> string(16) "FileMaker_Record" ["prevalidate"]=> bool(false) ["database"]=> string(11) "DD_Personal" ["username"]=> string(14) "xxxx" ["password"]=> string(12) "xxxx" } ["Vea4b3413"]=> NULL ["V9a3dcbce"]=> NULL } ["_layout"]=> string(23) "BW Newsletter2Go Import" ["V7a2db0ea"]=> NULL ["_script"]=> NULL ["_scriptParams"]=> NULL ["_preReqScript"]=> NULL ["_preReqScriptParams"]=> NULL ["_preSortScript"]=> NULL ["_preSortScriptParams"]=> NULL ["V0b9a204c"]=> string(16) "FileMaker_Record" ["_recordId"]=> NULL } } ["type"]=> string(2) "->" ["args"]=> array(0) { } } } ["callback"]=> NULL } Any help would be much appreciated!
    • By charmcello
      I am tasked with troubleshooting a web registration form that queries a Filemaker Pro v12 database via a Filemaker PHP API.
      The web form had been running well for a couple of months after major revision, when all of a sudden:
      All dropdowns are empty All radio buttons are missing These symptoms appear to be browser-independent. The appearance of these symptoms is mysterious:
      Nobody has modified the PHP code for the web form - I've done a compare with a backup done at the time when the web form was not broken and it is identical to what is currently on the server.  The Filemaker Pro layout that the web form is querying is just fine - all the value lists for the dropdowns and radio buttons are present. I've created a stripped-down version of the web form: https://campmeetings.cccsda.org/test_form.php and I've also attached the php source code file.
      The date and record fields are populating correctly. Notice the empty dropdown list after "Church I attend."
      Could this be caused by an incompatibility between the FMP PHP API and PHP libraries on the server? Perhaps due to a PHP update on the server? Any ideas how to troubleshoot this? 
      test_form.php