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

    • Edit a Value List via web PHP API (not using values from field)
      By Dave Carmean
      I would like to edit a value list via a web interface- I have done this using a field ("Use values from field"), but that [I incorrectly assumed, see doughemi's suggestion below!] requires adding/editing a record for each value, while (if possible) the textarea box would allow the editing of the whole value list at once.
      Genx showed how to display a value list...
      $layout = $fm->getLayout('my_template'); $list = array_map("htmlentities",(array)$layout->getValueList('my_list')); I am hoping there is some easy way to send back an edited valuelist…  We are using Filemaker Server 11 (not advanced).
      Thanks in advance!
    • FileMaker Server 14, El Capitan and PHP
      By jdavis
      Good Morning,
      Stumped with a FileMaker Server 14 installation and getting the PHP web pages to work. 
      Machine Specs:
      Mac OS X El Capitan v10.11.2
      Mac Pro (Mid 2012)
      Processor: 3.2GHz Quad-Core Intel Xeon
      Memory: 12Gb
       
      FileMaker Server 14.0.4.412 installed
      SuperContainer 2.93 installed
       
      When viewing the FM 14 Console:
      FM Server is Green
      Web Server is Greyed out, PHP is enabled and XML is enabled (See attachment of screen shot)
      Web Publishing Engine is Green
      ODBC/JDBC is Green
       
      When trying to run the test page (Server > Open Test Page and clicking Test PHP Custom Web Publishing)
      Getting Not Found, The requested URL /fmi-test/phptest.php was not found on this server
       
      When I hit the server from a browser, I noticed it's hitting from the Web Server Path and NOT the FM Server path.
      FM Server: Library > FileMakerServer > HTTPServer > htdocs
      Web Server: Library > WebServer > Documents
      The web server path is serving up HTML and showing the PHP code and not processing it. 
       
      Can anyone help with correcting this problem? We would greatly appreciate it. 

    • PayPal Notify FileMaker
      By angelleye
      Overview
      Get data from PayPal transactions pushed into FileMaker automatically, instantly when the transactions occur.  No more wasting time with manual data entry from PayPal into FileMaker!
      Our FileMaker PayPal IPN solution connects directly to FileMaker Server hosted databases using FileMaker’s PHP API.  This provides instant, seamless integration of PayPal IPN into FileMaker.
      FileMaker PayPal IPN Data Solution File A FileMaker database that stores all of the PayPal IPN data. This needs to be hosted on a FileMaker Server FileMaker PayPal IPN PHP Solution Files A PHP application that processes the PayPal IPN data and updates the FileMaker solution file accordingly. This needs to be hosted on a web server with PHP 5.3 or higher installed What Can I Do With It?
      The basic functionality of the solution is to automatically save data about any transaction that hits your PayPal account to your FileMaker system.  What this does for you is opens the door to automate tasks that could potentially chewing hours, days, even weeks of time!  With a couple of simple table relationships and FileMaker scripts, the possibilities are endless.
      Just a Few Examples
      Create new orders in your FileMaker system when payments are received in PayPal. Update the PayPal payment status of orders in your FileMaker system. Update FileMaker product / order details when an order is refunded. Trigger FileMaker scripts based on IPN transaction types or payment status. Flag orders where a customer has filed a dispute with PayPal. The best part is that this all happens automatically, instantly when the transaction hits PayPal!
    • [Solutions] PayPal Notify FileMaker
      By angelleye
      View File PayPal Notify FileMaker
       
      Overview
      Get data from PayPal transactions pushed into FileMaker automatically, instantly when the transactions occur.  No more wasting time with manual data entry from PayPal into FileMaker!
      Our FileMaker PayPal IPN solution connects directly to FileMaker Server hosted databases using FileMaker’s PHP API.  This provides instant, seamless integration of PayPal IPN into FileMaker.
      FileMaker PayPal IPN Data Solution File A FileMaker database that stores all of the PayPal IPN data. This needs to be hosted on a FileMaker Server FileMaker PayPal IPN PHP Solution Files A PHP application that processes the PayPal IPN data and updates the FileMaker solution file accordingly. This needs to be hosted on a web server with PHP 5.3 or higher installed What Can I Do With It?
      The basic functionality of the solution is to automatically save data about any transaction that hits your PayPal account to your FileMaker system.  What this does for you is opens the door to automate tasks that could potentially chewing hours, days, even weeks of time!  With a couple of simple table relationships and FileMaker scripts, the possibilities are endless.
      Just a Few Examples
      Create new orders in your FileMaker system when payments are received in PayPal. Update the PayPal payment status of orders in your FileMaker system. Update FileMaker product / order details when an order is refunded. Trigger FileMaker scripts based on IPN transaction types or payment status. Flag orders where a customer has filed a dispute with PayPal. The best part is that this all happens automatically, instantly when the transaction hits PayPal!
      Submitter angelleye Submitted 01/17/2016 Category Solutions FM Version FM Version: 1
    • PHP API Communication Error 22 driving me crazy!!??
      By angelleye
      I have this same solution I'm installing to 3 separate FM servers, but on one of them I can't get passed this Communication Error 22 for some reason.
      The error says it's the username or password, but it is imply not.  I am using as basic as it gets with a username of "php" and a password of "1111".  I also tried my regular admin account, but I get the same problem.
      I do have the FMPHP privilege set for both of these accounts...
       
      The server is on Windows with a fresh update of Java and then a fresh install of FMS14.  Deployment seems to go smoothly, and everything shows nice green lights.  The CWP test page loads just fine, too, which you can see in these images...

       

      I have also forwarded all of the ports that should be open for this machine.

      I am able to use Open Remote and open files from this server within FM Pro, but for some reason I cannot get the PHP API connection to work on this server.  
      Again, I have the same thing setup on multiple servers.  Here is a working example that spits out the available data sources.  Here is the exact same test script that is hitting my other FileMaker server at a different location, but it's returning the error.
      I can't think of what else to look at. Any information on how I can get this working would be greatly appreciated.  Thanks!