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

Craig Forster craig at qmediagroup.net
Wed Apr 20 17:12:05 MDT 2005


Hi Jane.

Ive seen this error a lot in the last few months, and wondered the same
thing...
For me the error seems sporadic (come up on some searches and not on others)
so that led me to believe the php code ive written is fine, but the issue is
in the database...

Two things I¹d check
* the layout doesn¹t contain any fields that no longer exist (fields you
have deleted) 
* That there is a related record. Sometimes with a 1-1 relationship, having
no related record can cause this. I fixed this yesterday with the addition
of a ­script.presort parameter ( the filemaker script simply said If
relatedTable::somefield=²² then set it to ³ ³). This was enough to create a
related record when there wasn¹t any present...

Your php addition now looks like this :

$search=new FX($serverIP,$portNumber,'FMPro7');
$search->SetDBData('peer_roster.fp7','Layout1',$groupSize);
$search->AddDBParam('LastName',$LastName);
$search->AddDBParam(Œ-script.presort¹ ,
¹filemaker_script_name_case_senstive¹)

Hope this helps,
Craig

-- 

Craig Forster
Software Designer
Particle Systems,
Christchurch,
New Zealand




On 21/4/05 10:45 AM, "Jane Chinn" <Jane.Chinn at cwu.EDU> wrote:

>  
> 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20050421/a88c3e7d/attachment.html


More information about the FX.php_List mailing list