fmwebschool.com
Top Experts [learn more]Top 4-10
webko

8868 K
bandmandq

2408 K
Genx

1525 K
4. tcmeyers
5. kbata
6. Martie
7. Hammerton
8. rrenfrow
9. bneeman
10. plegler
Welcome, Guest. Please login or register.
July 29, 2010, 05:56:35 AM

Login with username, password and session length
Search:     Advanced search
Welcome to the FileMaker Web Masters Exchange.  If you have any questions about how to use this forum, please watch the getting started movie at:
http://www.fmwebschool.com/movies/forum1/forum1.html
25084 Posts in 5523 Topics by 3916 Members
Latest Member: mrcst
* Home Help Search Calendar Login Register
+  fmwebschool.com
|-+  FMStudio
| |-+  FMStudio
| | |-+  error.php
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: error.php  (Read 4950 times)
mtalbart
Jr. Member
**
Offline Offline

Posts: 70
Kudos: 60


Disabled watercolorist trying to use PHP with FM


WWW
Applications:
error.php [Worth 50 Kudos points!]
« on: November 19, 2008, 07:13:10 PM »

I remain stymied by the error.php concept.  I'm assuming it is coming from the FMStudio_Tools.php file but I can't figure out how to use it.  My site was coming along well and then someone logged on who didn't have the data the FindRecordset was looking for.  I would like to simply redirect the visitor to a message to that effect and back to their home page.  But nothing I've tried accomplishes that.  I've tried to find documentation on this website but with no success.  Does anyone know how to use error.php?

Mike
Logged
bandmandq
Hero Member
*****
Offline Offline

Posts: 927
Kudos: 2408



WWW
Applications:
« Reply #1 on: November 19, 2008, 09:06:12 PM »

It is really easy....almost so easy, with FMStudio, that you might not understand because it is so easy.  (in my opinoin anyway)

create your error.php page

go to Bindings in FMStudio

Drag the errorCode and errorBsg bindings on your error.php page.  The will give the user, as you mentioned above the message "No records found" and then the error code number for that message.

Then you can just add a link that will take them to the home page... something like this  Click Here To continue  or some such message as a link.

Hope that is what you were looking for.  If you need more i can make you a short video.
Logged
mtalbart
Jr. Member
**
Offline Offline

Posts: 70
Kudos: 60


Disabled watercolorist trying to use PHP with FM


WWW
Applications:
« Reply #2 on: November 19, 2008, 10:05:11 PM »

I tried that, only instead of going to the new error.php page it told me that headings had already been sent by FMStudio_Tools line 307.

I've checked all the obvious reasons for the headings already sent (white space before php) but can't find anything, so it must be the way
FMStudio sends error messages.

I've noticed that sometimes FMStudio adds the "error.php" automatically and other times it adds the Filemaker name in front, as in:
if(FileMaker::isError($WebUser_result)) fmsTrapError($WebUser_result,"FileMaker/Error.php");

It seems like there should be a more user-friendly way to send the visitors to the appropriate page depending on search results.  (If they
don't have an entry, let them create one, etc.)

I've been working on this web site for two months and still can't get it to work (after reading every PHP/Filemaker/Dreamweaver book I can find). 

It's a complicated site since it involves an online art show entry,  workshop registrations, membership renewals, donations, etc. for a 750 member organization
(all volunteers, no paid staff - including me).

Mike
Logged
mtalbart
Jr. Member
**
Offline Offline

Posts: 70
Kudos: 60


Disabled watercolorist trying to use PHP with FM


WWW
Applications:
« Reply #3 on: November 23, 2008, 11:18:26 PM »

I may have a solution to my problem, but I would appreciate comments if I'm missing something.

What I am trying to do is control program flow after a recordset Find query.  For instance, when a member is taken to his home page, I want to offer him a link to his membershow results - but only if he has any (most won't).  So I'm operating on the assumption that if(FileMaker::isError($Test_result)) is a boolean (True or False).  I don't know enough php to figure out how to make that a negative statement (if the recordset doesn't exist), so I've set up a temporary varieble $skip that can be eiither "true" or "false".  If it's not true, everything that follows "if(FileMaker::isError($Test_result))" is skipped, if it's true, it is executed.  I can also use the $skip variable in the body of the page to either present a link or not.

Here's the code:

Code:
$ShowEntries_find = $WebUserLogin->newFindCommand('MemberShowEntryDetails');
$ShowEntries_findCriterions = array('ShowID'=>'=='.fmsEscape($CurrentShow_row->getField('ShowID')),'MasterID'=>'=='.fmsEscape($WebUser_row->getField('MasterID')),);

foreach($ShowEntries_findCriterions as $key=>$value) {
    $ShowEntries_find->AddFindCriterion($key,$value);
}
$ShowEntries_result = $ShowEntries_find->execute();

//The following substitutes for the FMStudios error trapping.
//It skips the paging of records if none were found.

if(FileMaker::isError($ShowEntries_result)) {  $skip="true";  }

     else

{   $skip="false";  }


If ($skip != "true")  {

$ShowEntries_row = current($ShowEntries_result->getRecords());

fmsSetPage($ShowEntries_find,'ShowEntries',10);

fmsSetLastPage($ShowEntries_result,'ShowEntries',10);

}
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!