[FX.php List] simple find in FM7 with Related fields

GTM Webmaster webmaster at grouptour.com
Thu Apr 21 09:31:24 MDT 2005


Jane,

I've found that in FM7 I can't pull information from a related record unless
the table instance I specified actually has a field or portal in it that
contains the related information.  Try this: in 'Layout1', create a field
containing the data from the related database table (let's call it
"OtherDBLayout").  Then use code like this:

$search=new FX($serverIP,$portNumber,'FMPro7');
$search->SetDBData('peer_roster.fp7','Layout1',$groupSize);
$search->AddDBParam('OtherDBLayout::LastName',$LastName);

$searchResult=$search->FMFindall();

... And then use ...

LastName: <? echo $searchData['OtherDBLayout::LastName'][0]; ?>

> 
> Hi,
> 
> When using FM Server 7 and a database with related fields contained in
> another FM7 Db and a page that does a test search(see php page below):
> I get an error which is:
> Warning: Cannot use a scalar value as an array in
> /Library/WebServer/Documents/forgetest/search_results.php on line 21
> 
> Warning: Invalid argument supplied for foreach() in
> /Library/WebServer/Documents/forgetest/search_results.php on line 21
>  LastName:
> 
> 
> <?php
> include_once('../FX/FX.php');
> include_once('../FX/FMErrors.php');
> include_once('../FX/server_data.php');
> 
> $LastName=$_POST['LastName'];
> 
> $groupSize='1';
> 
> $search=new FX($serverIP,$portNumber,'FMPro7');
> $search->SetDBData('peer_roster.fp7','Layout1',$groupSize);
> $search->AddDBParam('LastName',$LastName);
> 
> $searchResult=$search->FMFindall();
> 
> echo $searchResult['errorCode'];
> foreach($searchResult['data'] as $key=>$searchData);
> 
> ?>
> <html>
> <head>
> </head>
> <body>
> 
> LastName: <? echo $searchData['LastName'][0]; ?>
> </body>
> </html>
> 
> Does anyone know what causes this and how to fix it.  The relationship
> (LastName) is is actually in another database not in the one being
> searched.  This same simple search of another database with the same
> field name is not a problem.
> 
> Thanks,
> Jane
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 

Jim Bowser
Webmaster, GroupTour.com
Web site for
Shoreline Creations Ltd.
Publisher of:
  GROUP TOUR MAGAZINE
  STUDENT GROUP TOUR MAGAZINE

616-393-2077 x120
800-767-3489 x120
webmaster at grouptour.com
www.grouptour.com



More information about the FX.php_List mailing list