[FX.php List] Fatal error: Cannot use object of type FX_Error

William Akey wcakey at hotmail.com
Tue Dec 13 22:38:32 MST 2005


Dan,

Thanks a bunch for weighing in. Well, when I tried
print_r("<pre>".$result."</pre>"); as you suggested, the result was much
smaller -- in fact, it was reduced to one line:

Object ID #2

Yep, that is all that was returned. However, I have to say that I don't know
what that means any more than I understood the "mess" I was getting before.
Any thoughts?

As to the XML that is returned from the database if I follow the URL
provided by define("DEBUG", true)  , here is an example:

<FMPXMLRESULT>
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="03/01/2005" NAME="FileMaker Web Publishing Engine"
VERSION="7.0v5"/>
<DATABASE DATEFORMAT="MM/dd/yyyy" LAYOUT="cgi_cty" NAME="sppc_web.fp7"
RECORDS="5851" TIMEFORMAT="HH:mm:ss"/>
-
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Control_No" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Course_Type" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Course_Year" TYPE="TEXT"/>
</METADATA>
-
<RESULTSET FOUND="161">
-
<ROW MODID="2" RECORDID="4420">
-
<COL>
<DATA>4133</DATA>
</COL>
-
<COL>
<DATA>SPPC</DATA>
</COL>
-
<COL>
<DATA>2001</DATA>
</COL>
</ROW>
-
<ROW MODID="2" RECORDID="4440">
-
<COL>
<DATA>4153</DATA>
</COL>
-
<COL>
<DATA>SPPC</DATA>
</COL>
-
<COL>
<DATA>2001</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>


I am not an XML expert, but to me this looks OK except for the strange
dashed characters that appear periodically. Hmmmm..the first dashed
character does, in fact, appear on line 6 and maybe this is what is causing
PHP to have problems parsing the XML. Now, the question is, what is causing
those "-" characters to appear every few lines?

William

----- Original Message ----- 
From: "DC" <dan.cynosure at dbmscan.com>
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Sent: Tuesday, December 13, 2005 8:08 PM
Subject: Re: [FX.php List] Fatal error: Cannot use object of type FX_Error


> Try this instead of your basic print_r() function:
>
> print_r("<pre>".$result."</pre>");
>
> You can also make it a function:
>
> function pre($in, $exit=FALSE) {
> print_r("<pre>".$in."</pre>");
> if ($exit) {exit();}
> }
>
> Then call it like this:
>
> pre($result);
>
> or to exit right after showing the variable:
>
> pre($result,TRUE);
>
> It will turn that mess into something a little more readable in the
> browser.
>
> As far as the error goes, it sounds like there are some spurious
> characters in the XML that are gunking up the xml parsing in FX.php.
> Did you look at line 6 with the mismatched tag notice? What is at line
> 6?
>
> dan
>
> On Dec 13, 2005, at 10:51 PM, William Akey wrote:
>
> > Hi Dale,
> >
> > Thanks for your help. As I mentioned in my original post, when I use
> > print_r($result), and then exit, I get the following mess:
> >
> > FX_Error Object ( [error_message_prefix] => [mode] => 1 [level] =>
> > 1024
> > [code] => 100 [message] => FX: ExecuteQuery XML error: Mismatched  tag
> > at
> > line 6 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] =>
> > c:\Inetpub\wwwroot\FX\FX.php [line] => 1262 [function] => FX_Error
> > [class]
> > => FX_Error [type] => -> [args] => Array ( [0] => ExecuteQuery XML
> > error:
> > Mismatched tag at line 6 ) ) [1] => Array ( [file] =>
> > c:\Inetpub\wwwroot\FX\FX.php [line] => 1417 [function] => ExecuteQuery
> > [class] => FX [type] => -> [args] => Array ( [0] => -find ) ) [2]   =>
> > Array
> > ( [file] => c:\Inetpub\wwwroot\FX\FX.php [line] => 1641 [function] =>
> > FMAction [class] => FX [type] => -> [args] => Array ( [0] => -find
> > [1] =>
> > 1 [2] => full [3] => 1 ) ) [3] => Array ( [file] =>
> > c:\Inetpub\wwwroot\sppc_web\search_results.php [line] => 62
> > [function] =>
> > FMFind [class] => FX [type] => -> [args] => Array ( ) ) )   [callback]
> > => )
> >
> > I don't know how to interpret this. It does not look like records are
> > returned even though, as I mentioned, the URL that is passed to the
> > database
> > (shown by using define("DEBUG", true) ), is absolutely fine and, if
> > followed, returns the correct and proper XML and proper data with no
> > error.
> > I have not had this problem with other databases on the same server and
> > using pretty much the same code.
> >
> > Any ideas of things to try to solve this would be much appreciated.
> >
> > Thanks
> >
> > William
> >
> >
> > ----- Original Message -----
> > From: "Dale Bengston" <dbengston at preservationstudio.com>
> > To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> > Sent: Tuesday, December 13, 2005 6:51 PM
> > Subject: Re: [FX.php List] Fatal error: Cannot use object of type
> > FX_Error
> >
> >
> >> Hi William,
> >>
> >> What happens when you print_r($result) on the page? Are you getting
> >> what you're expecting back from FX?
> >>
> >> -Dale
> >> --
> >> Dale Bengston | Streamline Studio, LLC |
> >> dbengston at streamline-studio.com
> >> Associate Member, FileMaker Solutions Alliance
> >>
> >>
> >>
> >>
> >>
> >> On Dec 13, 2005, at 4:43 PM, William Akey wrote:
> >>
> >>> Hi Folks,
> >>>
> >>> I have a situation where I consistently get the following error:
> >>>
> >>> Fatal error: Cannot use object of type FX_Error as array in
> >>> c:\Inetpub\wwwroot\sppc_web\search_results.php on line 67
> >>>
> >>> when I try to access $result['errorCode'] or $result['foundCount'].
> >>>
> >>> If I use: FX::isError($result), then I don't get the Fatal error
> >>> message,
> >>> but there is still an error. When I turn on define("DEBUG", true),
> >>> and use
> >>> Print_r ($result), I get the following page:
> >>>
> >>> ***************************
> >>> Accessing FileMaker Pro 7 data.
> >>>
> >>> Using FileMaker URL:
> >>> http://127.0.0.1:80/fmi/xml/FMPXMLRESULT.xml?-db=sppc_web.fp7&-
> >>> lay=cgi_cty&-max=20&First_Name.op=eq&First_Name=Michael&-find
> >>>
> >>> FX_Error Object ( [error_message_prefix] => [mode] => 1 [level] =>
> >>> 1024
> >>> [code] => 100 [message] => FX: ExecuteQuery XML error: Mismatched
> >>> tag at
> >>> line 6 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] =>
> >>> c:\Inetpub\wwwroot\FX\FX.php [line] => 1262 [function] => FX_Error
> >>> [class]
> >>> => FX_Error [type] => -> [args] => Array ( [0] => ExecuteQuery XML
> >>> error:
> >>> Mismatched tag at line 6 ) ) [1] => Array ( [file] =>
> >>> c:\Inetpub\wwwroot\FX\FX.php [line] => 1417 [function] =>
> >>> ExecuteQuery
> >>> [class] => FX [type] => -> [args] => Array ( [0] => -find ) ) [2]
> >>> => Array
> >>> ( [file] => c:\Inetpub\wwwroot\FX\FX.php [line] => 1641 [function] =>
> >>> FMAction [class] => FX [type] => -> [args] => Array ( [0] => -find
> >>> [1] => 1
> >>> [2] => full [3] => 1 ) ) [3] => Array ( [file] =>
> >>> c:\Inetpub\wwwroot\sppc_web\search_results.php [line] => 62
> >>> [function] =>
> >>> FMFind [class] => FX [type] => -> [args] => Array ( ) ) )
> >>> [callback] => )
> >>> ***********************************
> >>>
> >>> However, what is unusual is that, if I follow the URL above that is
> >>> generated by the debug process, it works fine and returns perfect
> >>> XML with
> >>> an errorcode of "0" and the exact data that I would expect. I have
> >>> tried
> >>> everything I can think of, including reducing the search page to
> >>> one single
> >>> value and adding only one parameter to the FMFind() call. It seems
> >>> that the
> >>> XML that is being passed to the database works correctly, but
> >>> somehow I still get some unknown error. Since I can't use
> >>> $result['errorCode'], I can't even find out what the error is.
> >>>
> >>> Any help you could provide would be most welcome.
> >>>
> >>> Thanks
> >>>
> >>> William
> >>> _______________________________________________
> >>> FX.php_List mailing list
> >>> FX.php_List at mail.iviking.org
> >>> http://www.iviking.org/mailman/listinfo/fx.php_list
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> FX.php_List mailing list
> >> FX.php_List at mail.iviking.org
> >> http://www.iviking.org/mailman/listinfo/fx.php_list
> >>
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> >
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>


More information about the FX.php_List mailing list