[FX.php List] If statements

Anders Monsen andersm at alamark.com
Thu Sep 11 07:49:42 MDT 2008


There are probably a variety of ways depending on how you want to  
handle different error code. Do you mean something this? This shows  
both the code and message, pulling from the FMErrors.php page with the  
errorsList array. Perhaps the fuzzy debugger would obviate this.

--------------
include_once('../FX/Developer/FMErrors.php');


// snip
> $search->AddDBParam('Pass_search',"==".$password);
> $result =$search -> FMFind();

if (FX::isError($result) || $result['errorCode'] != 0) {
      if (FX::isError($result)) { // non-FileMaker Errors are handled  
first
          $errorMessage = $result->message;
      } else { // now handle FileMaker errors
          $errorMessage = $result['errorCode'] . ' ' .  
$errorsList[$result['errorCode']];
      }
	// display any error code and error message
	echo $errorMessage;
}

--------------

Thanks,
Anders Monsen


On Sep 11, 2008, at 3:56 AM, Josh Shrier wrote:

> With these variables how can I trap here for the error code of the  
> found code?
>
>
> $search=new FX('','');
> $search->SetDBData(');
> $search->SetDBPassword();
> $search->AddDBParam('User_search',"==".$username);
> $search->AddDBParam('Pass_search',"==".$password);
> “?????”
> $searchResult =$search -> FMFind();
> foreach($searchResult['data'] as $key=>$searchData)
>
> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-bounces at mail.iviking.org 
> ] On Behalf Of Tim 'Webko' Booth
> Sent: Thursday, September 11, 2008 9:01 AM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] If statements
>
>
> On 11/09/2008, at 1:44 PM, Josh Shrier wrote:
>
>
> I want to trap if found count is 0 display message and nothing else  
> and if found count>0 display results page. Can someone please help me.
>
> In the original find:
>
>                         $searchProject = $searchProject -> FMFind();
>                         $searchProjectCount =  
> $searchProject['foundCount'];
>
> In the page
>
> <?php              if ($searchProjectCount == 0) { ?>
> <h1>Oh noes, there's nothing therrrreeeee</h1>
>
> <?php              } else { ?>
> <h1>Whatever is to appear other wise</h1>
>
> <?php              } ?>
>
>
> That's if you didn't trap for a 401 in the first place...
>
> Cheers
>
> Webko
> _______________________________________________
> 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://mail.iviking.org/pipermail/fx.php_list/attachments/20080911/a3a55234/attachment.html


More information about the FX.php_List mailing list