DanBrill Posted August 29, 2004 Posted August 29, 2004 Hey gang, I've taken the plunge and have taken FM to the web, or at least I'm making good progress in that direction. I'm using PHP 5 with FX.php on Windows XP with the IIS server. I'm Using FM6 Pro for testing and learning at the moment, but will switch to FM7 Advanced Server once it comes out... I'm working through chapter 8 of Bob Bowers and Steve Lane's book "Advanced FileMaker Pro 6 Web Development." Having really good success, but am stuck at p 292. I'm trying to use the FX.php FMEdit() to edit an existing record. I understand that this command works only on a single record at a time, based on the -recid. I can find a single record using FMFind(), returning the data to a variable, $MyResult. However, it doesn't appear that the -recid is a part of the $MyResult array. So: 1: How do I find the -recid 2: How do I parse it out of the array so that I can use it with FMEdit() (That is, what is the syntax for referencing array elements so I can find -recid?) Thanks, Dan
Bob Minteer Posted August 30, 2004 Posted August 30, 2004 Dan, You can pick off the recID similar to this snippet I am including below. This particular one using an FMNew() function. The recID (and modID) can be snagged in the same way from an FMFind() before you perform the FMEdit(). If I am editing an existing record, I will do the FMFind, grab the recID and stash it in a session variable. Then, if the user edits (updates) the record, I have the recID ready to use when calling FMEdit(). Hope this helps! regards... Bob Minteer - - - Snippet from one of my pages - - - - - $update = new FX ($FMAddress,$FMPort); $update->SetDBData ('remarks.fp5', 'raw', 1); $update->SetDBPassword ($syspassword, $sysusername); $update->AddDBParam ('MagicNumber', $recordID); $update->AddDBParam ('Summary', $_POST['summary']); $update->AddDBParam ('RemarkText', $_POST['moreinfo']); $update->AddDBParam ('Operator', $sessUserName); $result=$update->FMNew(); // Change the mode so that we will see the add note button. $sessCurFunc = "view"; if($result['errorCode']!=0){ echo "Error Code Returned: " . $result['errorCode'] . "<br>n"; exit; } $recKey = key($result['data']); $recordPointers = explode (".",$recKey); // where $key is the current key from $ReturnedData['data'] $recID = $recordPointers[0]; // here's the RecordID $modID = $recordPointers[1]; // and here's the ModifyID - - - - - - - - - - - - - - - - - - -
DanBrill Posted August 30, 2004 Author Posted August 30, 2004 Perfect! I didn't realize that that's how the RecID and ModID were passed back. After doing some more reading about arrays last night, this all makes sense. Thanks so much. Glad you've joined the Formus, Bob. Dan
Recommended Posts
This topic is 7467 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 accountSign in
Already have an account? Sign in here.
Sign In Now