Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5012 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a PHP script that is 3 separate FileMaker finds show 3 separate tables of results. I am having trouble when one of finds returns no records, in this case the while script dies (but I am not telling the script to die anywhere).

here is the important code where I know its breaking but I'm not sure how to make it move on.


....

$result = $request->execute();



if(FileMaker::isError($result)) {

	

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

	}else{  .... bunch of code.....



$request2 = $FMDB->newFindRequest('fm_layout');

....

....

$result2 = $request2->execute();



if(FileMaker::isError($result2)) {

	

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

	}else{  .... bunch of code.....

...



$request3 = $FMDB->newFindRequest('fm_layout');

....

....

$result3 = $request3->execute();



if(FileMaker::isError($result3)) {

	

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

	}else{  .... bunch of code.....

...







Any suggestion on make the script move on to request 2 if request 1 has no records found would be much appreciated.

Posted

The only problem I can see with the code you posted is that the 'else' block is not closed. My assumption is that happened when trimming the code down to post here; is that correct? (are your 'else' block's closed in your actual php file?)

What error are you getting?

On your development computer, it's best to have error's shown by default (set in php.ini), but you can also enable it in your script with...


ini_set("display_errors","on");

error_reporting(E_ALL^E_NOTICE); // this may also have to be E_ALL^E_NOTICE^E_DEPRECATED depending on what version of php you're running.

(Thanks Genx, for those lines of code)

Posted

I'm not getting a PHP type error. All the existing code is working. I may have been unclear on the results that I want to see.

If request1 returns no records my

if(FileMaker::isError($result)) {

	

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

	}




Works perfectly but if that happens on the first of my 3 requests that it does not move on to request 2 and 3 to show me those results.   I need it to show me 3 sets of records or 3 messages saying no records found or any combination of the 3.  



kind of like 



Request 1

    No records found



Request 2 

     Record  22

     Record  898

     Record  653





Request 3

    Record......





but right now in this example I doesn't show many anything for request 2 or 3 if  request 1 has no records.



The only problem I can see with the code you posted is that the 'else' block is not closed. My assumption is that happened when trimming the code down to post here; is that correct? (are your 'else' block's closed in your actual php file?) What error are you getting? On your development computer, it's best to have error's shown by default (set in php.ini), but you can also enable it in your script with...

(Thanks Genx, for those lines of code)


ini_set("display_errors","on");

error_reporting(E_ALL^E_NOTICE); // this may also have to be E_ALL^E_NOTICE^E_DEPRECATED depending on what version of php you're running.

Posted

In that case, maybe your request2 and request3 blocks of code are in the first 'else' block. Are all your 'else' blocks closed as in this code below?


....

$result = $request->execute();



if(FileMaker::isError($result)) {

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

}else{

	.... bunch of code.....

}// ADD THIS CLOSING BRACKET



$request2 = $FMDB->newFindRequest('fm_layout');

....

....

$result2 = $request2->execute();



if(FileMaker::isError($result2)) {

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

}else{

	.... bunch of code.....

}// ADD THIS CLOSING BRACKET



$request3 = $FMDB->newFindRequest('fm_layout');

....

....

$result3 = $request3->execute();



if(FileMaker::isError($result3)) {

	$apps_html = '<p>(No Pending records found.  Records will be displayed here)</p>';

}else{

	.... bunch of code.....

}// ADD THIS CLOSING BRACKET

....

Posted

Just a note on this - trimming the code to the point where it's not readable and .......ing out key peices of information is not a good idea.

This topic is 5012 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.