Pb with function getRecordById in API

Pb with function getRecordById in API

am 10.11.2007 10:20:14 von Andy2500

Dear Sirs,

I'm learning API for FMP with some examples, then I have
always the problem with function getRecordById, particularity
the variable " recid ", it returns always error :

Undefined index: recid

when I used

$record = $fm-> getRecordById ('Layout1', $_GET['recid']);

or empty($_REQUEST['recid'] = TRUE !


Here are the examples :


define( 'FM_HOST', '127.0.0.1' );
define( 'FM_FILE', 'Test' );
define( 'FM_USER', 'php' );
define( 'FM_PASS', 'php' );

require_once ('FileMaker.php');

$fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);

$record = $fm-> getRecordById ('Layout1', $_GET['recid']);

$id = $record->getField('ID');

...............

or

$fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);

if (empty($_REQUEST['recid'])) {
die('The record id is missing.');
}

.................


Would you like to tell me where is the value of "recid"
and how do I define it ?


Thanks in advance for the help!

Re: Pb with function getRecordById in API

am 10.11.2007 16:32:59 von ursus.kirk

Untested, as I have no experience with php.

The recordID normaly is hidden within FMP. You have to make it visible
either by a calculation.
cRecordID < calculation ; number ; Get(RecordID) >. Get the contents from
this field.
But then you will still have to know what information is in this record you
want retrieve. How would you know beforehand that this is the ID you want?
Normally within FMP the recordID is not soemthing I would use, but with php
things might differ.

Keep well, Ursus


"Andy2500" schreef in bericht
news:473585e1$1_2@news.bluewin.ch...
> Dear Sirs,
>
> I'm learning API for FMP with some examples, then I have
> always the problem with function getRecordById, particularity
> the variable " recid ", it returns always error :
>
> Undefined index: recid
>
> when I used
>
> $record = $fm-> getRecordById ('Layout1', $_GET['recid']);
>
> or empty($_REQUEST['recid'] = TRUE !
>
>
> Here are the examples :
>
> >
> define( 'FM_HOST', '127.0.0.1' );
> define( 'FM_FILE', 'Test' );
> define( 'FM_USER', 'php' );
> define( 'FM_PASS', 'php' );
>
> require_once ('FileMaker.php');
>
> $fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
>
> $record = $fm-> getRecordById ('Layout1', $_GET['recid']);
>
> $id = $record->getField('ID');
>
> ..............
>
> or
>
> $fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
>
> if (empty($_REQUEST['recid'])) {
> die('The record id is missing.');
> }
>
> ................
>
>
> Would you like to tell me where is the value of "recid"
> and how do I define it ?
>
>
> Thanks in advance for the help!
>
>

Re: Pb with function getRecordById in API

am 11.11.2007 20:11:22 von jeroen

On Nov 10, 4:32 pm, "Ursus" wrote:
> Untested, as I have no experience with php.
>
> The recordID normaly is hidden within FMP. You have to make it visible
> either by a calculation.
> cRecordID < calculation ; number ; Get(RecordID) >. Get the contents from
> this field.
> But then you will still have to know what information is in this record you
> want retrieve. How would you know beforehand that this is the ID you want?
> Normally within FMP the recordID is not soemthing I would use, but with php
> things might differ.
>
> Keep well, Ursus
>
> "Andy2500" schreef in berichtnews:473585e1$1_2@news.bluewin.ch...
>
>
>
> > Dear Sirs,
>
> > I'm learning API for FMP with some examples, then I have
> > always the problem with function getRecordById, particularity
> > the variable " recid ", it returns always error :
>
> > Undefined index: recid
>
> > when I used
>
> > $record = $fm-> getRecordById ('Layout1', $_GET['recid']);
>
> > or empty($_REQUEST['recid'] = TRUE !
>
> > Here are the examples :
>
> > >
> > define( 'FM_HOST', '127.0.0.1' );
> > define( 'FM_FILE', 'Test' );
> > define( 'FM_USER', 'php' );
> > define( 'FM_PASS', 'php' );
>
> > require_once ('FileMaker.php');
>
> > $fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
>
> > $record = $fm-> getRecordById ('Layout1', $_GET['recid']);
>
> > $id = $record->getField('ID');
>
> > ..............
>
> > or
>
> > $fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
>
> > if (empty($_REQUEST['recid'])) {
> > die('The record id is missing.');
> > }
>
> > ................
>
> > Would you like to tell me where is the value of "recid"
> > and how do I define it ?
>
> > Thanks in advance for the help!- Hide quoted text -
>
> - Show quoted text -

The recid value is passed by a GET or POST (second form) request to
the script. Keep Ursus' post in mind: normally the internal record ID
is not used in FileMaker itself, but is common practiceto retrieve it
when using the PHP API. For example, you display a page with a list of
records, and for each one you create a link to a record details page
using the record ID.


Regards,


Jeroen