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

9743 K
bandmandq

2458 K
Genx

1525 K
4. tcmeyers
5. kbata
6. Martie
7. Hammerton
8. rrenfrow
9. bneeman
10. plegler
Welcome, Guest. Please login or register.
June 18, 2013, 02:09:02 PM

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
27507 Posts in 6073 Topics by 1524 Members
Latest Member: fmwebster
* Home Help Search Calendar Login Register
+  fmwebschool.com
|-+  PHP Web Publishing Technologies
| |-+  FileMaker PHP, FX.php custom web publishing
| | |-+  [SOLVED] edit record with dynamic data link
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: [SOLVED] edit record with dynamic data link  (Read 1522 times)
glucas3232
Hero Member
*****
Offline Offline

Posts: 204



Applications:
« on: May 03, 2009, 10:12:07 PM »

 In broadest terms, I want to have a record created JOB POST that sends an email with a dynamic link to the record to a moderator for approval. Moderator clicks the link, the record is found, and the status is set to approved. I seem to be find the record, but it is not being edited.

Here's my approach in the code:

ADD_NEW_JOB.php  //presents form to describe job post


ADD_JOB_RESULT.php  //this page adds the Job Post to the database and sends an email to the moderator
<snip>
$FMStudio_Emailer_body = "New Job Posted for Review. To confirm this post, click this link: http://talentbase-austin.com/freelance-jobs/jobs/JB_job_new/confirm_jobpost.php?id=<<jobID>>";
</snip>

correctly identifies the job record in the link and presents the following via email:
New Job Posted for Review. To confirm this post, click this link: http://talentbase-austin.com/freelance-jobs/jobs/JB_job_new/confirm_jobpost.php?id=J1574

So far, so good, everything works.

Now, after clicking the above emailed link and returning to confirm_jobpost.php  //I don't get an error, just a blank page and no record update.

CONFIRM_JOBPOST.php [FIND RECORD]
<snip>
$Jobs_find = $FMGreet->newFindCommand('JB_jobs');
$Jobs_findCriterions = array('jobID'=>'=='.fmsEscape($_REQUEST['id']),);   //should find current jobID (e.g. J1574)
foreach($Jobs_findCriterions as $key=>$value) {
    $Jobs_find->AddFindCriterion($key,$value);
}

fmsSetPage($Jobs_find,'Jobs',10);


$Jobs_result = $Jobs_find->execute();

if(FileMaker::isError($Jobs_result)) fmsTrapError($Jobs_result,"error.php");

fmsSetLastPage($Jobs_result,'Jobs',10);

$Jobs_row = current($Jobs_result->getRecords());

$job_edit_edit = $FMGreet->newEditCommand('JB_jobs',$job_edit_row->getRecordId());     //get currnet recid to edit
$job_edit_fields = array('job_status'=>'approved',);  //change status of 'job_status' (text field) to 'approved'
foreach($job_edit_fields as $key=>$value) {
    $job_edit_edit->setField($key,$value);
}

$job_edit_result = $job_edit_edit->execute();

if(FileMaker::isError($job_edit_result)) fmsTrapError($job_edit_result,"error.php");

$job_edit_row = current($job_edit_result->getRecords());

fmsRedirect('Job_confirmed.php');   //redirect to completion page; thank moderator.
</snip>

I'm stumped. Any one see anything glaring wrong with this approach?






« Last Edit: July 30, 2009, 09:46:39 PM by glucas3232 » Logged
glucas3232
Hero Member
*****
Offline Offline

Posts: 204



Applications:
« Reply #1 on: May 04, 2009, 03:04:12 PM »

anybody?
Logged
glucas3232
Hero Member
*****
Offline Offline

Posts: 204



Applications:
« Reply #2 on: May 05, 2009, 09:31:12 AM »

Ok, maybe not the most elegant approach, but I added a script in FM and let FM do the work. Anyone have a more efficient idea?

<snip>
$Jobs_find = $FMGreet->newFindCommand('JB_jobs');
$Jobs_findCriterions = array('jobID'=>'=='.fmsEscape($_REQUEST['id']),);
foreach($Jobs_findCriterions as $key=>$value) {
    $Jobs_find->AddFindCriterion($key,$value);
}

fmsSetPage($Jobs_find,'Jobs',10);

$Jobs_find->SetScript('ApproveJobPost','');


$Jobs_result = $Jobs_find->execute();

if(FileMaker::isError($Jobs_result)) fmsTrapError($Jobs_result,"error.php");

fmsSetLastPage($Jobs_result,'Jobs',10);

$Jobs_row = current($Jobs_result->getRecords());

fmsRedirect('job_confirmed.php');

// FMStudio v1.0 - do not remove comment, needed for DreamWeaver support ?>

</snip>
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!