Jump to content
Server Maintenance This Week. ×

Php api result set contains multiple versions of the first result


This topic is 3486 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

I'm new at FileMaker and trying to get data out via the API.

The issue I'm having is when I create a newFindCommand and execute it the resulting record set contains as many rows as there are in the layout but each row is the same. More specifically, each row is a copy of the FIRST row in the database.

 

E.g. I'm looking for products with a product code like 'XXX', of which there should be 7. I get 7 rows back but each one is the same product.

 

I've looked a couple of tutorials online and they do exactly the same operations I do so I'm lost as to why my results come out this way.

 

Any advice?

 

Thanks

Link to comment
Share on other sites

This is my code for this problem, maybe it will stimulate a response. I haven't been able to track the cause myself yet.

 

$findCommand = $productsFM->newFindCommand($productsLayout);
$findCommand->addFindCriterion('Product Code', 'XX123');
$findCommand->addSortRule('Product Code', 1);
 
$result = $findCommand->execute();
 
if (FileMaker::isError($result)) {
echo "<p>Error: " . $result->getMessage() . "</p>";
exit;
}
 
$records = $result->getRecords();
 
From that point, if I iterate through $records outputting the stock code and description,  for example, I'll get the same stock code and description output x times where is the number of rows returned and the correct number of products in the database matching the query.
 
Is this a glitch in my code, my understanding of FM or something to do with the tables/layouts in FM themselves?
 
Thank you
Link to comment
Share on other sites

I fixed this be re-installing the API for PHP files (FileMaker.php and the FileMaker folder).

It turns out when I first tried my script I got several errors like this one:

 

Deprecated: Assigning the return value of new by reference is deprecated in C:xampphtdocsfileMakerTestFileMakerImplementationParserFMResultSet.php on line 72

 

I removed the =& new and changed it to = new for each of the lines without issue EXCEPT FOR THE LINE ABOVE. Fixing the error for line 72 then made the FileMaker API return the last row repeatedly. Not sure why but I'm now getting the results back as they should be. 

Link to comment
Share on other sites

This topic is 3486 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.