Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

passing "Attendee_ID" in a url to find a record

Featured Replies

hello..

(thanks for your help with related fields, prev posts)

i have a calculated URL field that includes a random, alpha numeric string, uniquely identifying a meeting attendee. This URL is part of an email invitation each attendee receives. I'd like prospective attendee to click the link and be taken to 'form.php' AND looking at their record (which will have been partially completed in advance). Something like:

"http://server/form.php?Attendee_ID=" & Attendee_ID

i can make this work by substituting "recid" for "Attendee_ID", but that's not alphanumeric, nor is it random. I don't people trying out different recid's and viewing other records. :o

i used to do this in CDML, but don't know the equivalent in PHP?

thanks in advance

brian

Could you elaborate a little more on exactly what isn't working when you attempt to retrieve a record based on passing Attendee_ID via the URL?

example code is always helpful

  • Author

sorry.. :o

here's what i'd started with, based on jon starks' book:


$attendee = $fm->getRecordById('table', $_GET['recid']);





in filemaker.. the calc for the URL becomes:





"http://server/form.php?recid=" & recid





this works.. but what i want is to use my "Attendee_ID" field instead of "recid". But then i can't use 'getRecordByID'. I imagine there is some function like:





$attendee = $fm->FUNCTION('table', $_GET['Attendee_ID']

"FUNCTION" is what i'm looking for..

OK so you need to know how to perform a find with the API.


$findreq = $fm->newFindCommand("layout_name");

$findreq->addFindCriterion("Attendee_ID", $_GET['Attendee_ID']);

$result = $findreq->execute();

if (FileMaker::isError($result)) {

	echo 'Error: (' . $result->getCode() . ') ' . $result->getMessage() . "n";

	exit;

}



$records = $result->getRecords(); 



if (FileMaker::isError($records)) {

	echo 'Error: (' . $records->getCode() . ') ' . $records->getMessage() . "n";

	exit;

}



Will get you what you need. Filemaker has a whole series of "find commands" There's a reasonable description of how they work in this pdf from Filemaker

(starting on page 35)

  • Author

sorry, the proverbial light bulb hasn't gone off yet. I follow (i think) your code. But how does $records (from your example) coincide with:

$attendee = $fm->FUNCTION('layout', $_GET['Attendee_ID']);




in other words, all of my attendee fields on the form are being pulled with:




echo $attendee->getField('First Name');




so everything's based on $attendee, correct? How do i get $records involved? I feel like i'm close, but haven't connected this just yet.



thank you





OK so you need to know how to perform a find with the API.

Will get you what you need. Filemaker has a whole series of "find commands" There's a reasonable description of how they work in this pdf from Filemaker

(starting on page 35)


$findreq = $fm->newFindCommand("layout_name");

$findreq->addFindCriterion("Attendee_ID", $_GET['Attendee_ID']);

$result = $findreq->execute();

if (FileMaker::isError($result)) {

	echo 'Error: (' . $result->getCode() . ') ' . $result->getMessage() . "n";

	exit;

}



$records = $result->getRecords(); 



if (FileMaker::isError($records)) {

	echo 'Error: (' . $records->getCode() . ') ' . $records->getMessage() . "n";

	exit;

}



  • Author

got it! :

so, after this:

$records = $result->getRecords(); 






i needed to add THIS to isolate 'attendee'


$attendee = $records[0];

works great now.. i can pass whatever field i like in the URL. Thanks for getting me 99% of the way : A rather large door just opened in my head. Excellent.

many thanks!

I guess my post was a little obtuse. I'm glad you got it, but I'll attempt to clarify in the interest of anyone who might be come to this later.

The successful execution of a find request


$result = $findreq->execute();



Returns a Filemaker_Result object.



The Filemaker_Result object has a function called getRecords()



$records = $result->getRecords(); 



This returns an array of Filemaker_Record objects. It still returns an array even if it only finds one record.  As bhamm pointed out you can access the first record in the array with $records[0]  You can also loop through the array with foreach





foreach($records as $rec){

      $rec->getField("field_name");

}

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.