Jump to content

  •  

Photo

Perpetually creating blank records

php blank records blank

  • Please log in to reply
6 replies to this topic

#1 VickyLNesbitt  newbie

VickyLNesbitt
  • Members
  • 9 posts
  • Time Online: 3h 32m 44s

Posted 02 July 2014 - 03:14 AM

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


  • 0

#2 doughemi  lifetime learner

doughemi
  • Members
  • 768 posts
  • FM Application:13 Advance
  • Platform:Cross Platform
  • Skill Level:Intermediate
  • Time Online: 94d 12h 6m 35s

Posted 02 July 2014 - 09:50 AM

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.


  • 0

Give the gift of life. Register as an organ donor today!
http://www.organdonor.gov/become.asp


#3 webko  master

webko
  • Members
  • 320 posts
  • LocationSydney, Australia
  • FM Application:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Membership:TechNet, FileMaker Business Alliance
  • Time Online: 25d 2h 22m 32s

Posted 02 July 2014 - 05:02 PM

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


  • 0

#4 VickyLNesbitt  newbie

VickyLNesbitt
  • Members
  • 9 posts
  • Time Online: 3h 32m 44s

Posted 03 July 2014 - 01:22 AM

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


  • 0

#5 webko  master

webko
  • Members
  • 320 posts
  • LocationSydney, Australia
  • FM Application:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Membership:TechNet, FileMaker Business Alliance
  • Time Online: 25d 2h 22m 32s

Posted 03 July 2014 - 03:15 PM

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...


  • 0

#6 VickyLNesbitt  newbie

VickyLNesbitt
  • Members
  • 9 posts
  • Time Online: 3h 32m 44s

Posted 11 July 2014 - 06:50 AM

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!


  • 0

#7 webko  master

webko
  • Members
  • 320 posts
  • LocationSydney, Australia
  • FM Application:11 Advance
  • Platform:Cross Platform
  • Skill Level:Expert
  • Membership:TechNet, FileMaker Business Alliance
  • Time Online: 25d 2h 22m 32s

Posted 13 July 2014 - 04:10 PM

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

 

Good catch


  • 0





FMForum Advertisers