Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

i am working on a site where i am expecting to get back a single row as the result of a search.

i know how to iterate thru all the rows using

foreach ($response->getRecords() as $record ) {}

and I have used this to get a single record by id

$record = $fm->getRecordById('sku_web', $_GET['id']);

but i'm just not sure on the syntax to get the first record from the getRecords() array.

thanks

andy

Posted

hi,

I'm using a little trick:

If I'm searching for any field which contains an unique value, I use:

$records = $result->getRecords();

$record = $records[0]; // There is only the first one ;-)

$field = $record->getField('FileMakerField');

Searching a record ID looks like:

$data = $fm->getRecordById('layout', $_SESSION['record_id']);

$name = $firmendaten->getField('Name',0);

Hope, this helps a little bit.

/horst

Posted

$data = $fm->getRecordById('la yout', $_SESSION['record_id']);

$name = $firmendaten->getField ('Name',0);

Probably a typo, should be:

$data = $fm->getRecordById('layout', $_SESSION['record_id']);

$name = $data->getField ('Name',0);




$records = $result->getRecords(); $record = $records[0]; // There is only the first one ;-) $field = $record->getField('FileMakerField');
Works, but i prefer:

$record = current($result->getRecords());

$field = $record->getField('FileMakerField');
  • 3 weeks later...

This topic is 6165 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.