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 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
    • By DeathRobot
      Hi. I am trying to script the getting of some data from a website that has an API. I have BaseElementsPlugin and was given an example bit of code by the website:
       data = {'domain': domain, 'include_generic': True}
                  headers = {'X-Api-Key': 'xyz123'}
                  resp = requests.post('https://api.anymailfinder.com/v3.0/search/domain.json', data=data, headers=headers)
      I have never dealt with this kind of programming and am not even sure where this info would go or what script step(s) I would use to call this. Is this CURL? Are you aware of sample FM scripting that I could use as a model to figure this out?
      Thanks for any help with this!
    • By Marcwa19197
      Hi,

      we are using a little sync script via php, which allows us to store all data from a FileMaker DB into our internal MySQL-Database. 
      The only problem iam unable to solve is how to download images from container fields and store them local on our web server. 

      I tried something like:
       
      foreach($recordsPersons as $recordPersonsData) { //saving images to /srv/www/htdocs/ $url_orig = urlencode($recordPersonsData->getField('FotoDatei')); // Search for the extension of the file $url = substr($url_orig, 0, strpos($url_orig, "?")); $url = substr($url_orig, strrpos($url_orig, ".") + 1); // Send the correct Content-Type header if($url == "jpg"){ header('Content-type: image/jpeg'); } else if($url == "gif"){ header('Content-type: image/gif'); } else{ header('Content-type: application/octet-stream'); } // save file local. file_put_contents('/srv/www/htdocs/testfilepicture.jpg', $fm->getContainerData($url_orig)); } I was using this reference: http://blog.myfmbutler.com/?p=104

      This Code-Snipped works well, but only writes "getContainerData() does not support remote containers" into testfilepicture.jpg..

      We are using FileMaker Server 14.

      Any Ideas?

      Thanks in advance and Cheers
    • By Zuke
      Ok here is my problem.  I have created a  summary report that pulls together weekly reports for projects under a specific office of work.  SO each report generated could be specific to a set area.  In the report layout i set it up with a title header for the cover sheet, a sub summary section which shows each sub- group, a sub summary section that has all the project specific text and report, and then the body which has pictures and captions for the project. The pictures and captions are repetitions 1-8 of the same fields.  So it is supposed to look like this
       
      -------------
      title page(area name)                      Title Header
      -------------
      -Sub area                                         Sub Summary 
      -------------
      Project data info                    Sub Summary
      -------------
      Picture 
      Caption
      Picture[2]
      Caption [2]
      ---------------
      Picture [3]
      Caption[3[                                Body
      Picture [4]
      Caption [4]
      ---------------
      Picture[5]
      Caption[5]
      picture[6]
      caption[6]
       
      The trouble I am having is if a user only enters, say 4 pictures instead of 8,  I will have 2 blank pages that need to be removed.  I didnt have much luck in sliding up cause i had pictures on both sides of a page break and the page layout was not consistent from one report to the next.   I need to find a way to remove the blank page that occurs if there is less than 8 pictures with the report.
       
      Any help would be appreciated.