[FX.php List] Basic help

CSInfo CSinfo at comcast.net
Wed May 28 08:35:36 MDT 2008


Thanks, I was wondering about the Record ID field, In another DB I worked on
that field was already there. I will try that.
John

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Bob Patin
Sent: Wednesday, May 28, 2008 9:26 AM
To: FX.php Discussion List
Subject: Re: [FX.php List] Basic help

You don't HAVE to use separate pages; here's how you can do it:

(this is your 2nd page)

STEP ONE: find the record

$mySearchVariable = $_POST['myName']; <- or whatever you want to search for

$find = new FX('64.62.67.186','80','FMPro7');
$find->SetDBData('BG_Clients','BGDB Export'); $find->SetDBUserPass('Admin',
'iona'); $find->AddDBParam('field_that_you_are_searching',
$mySearchVariable); $findResult = $find->FMFind();

// here you should put some sort of error-checking to make sure you're
finding something if ($requestResult['errorCode']==0){
	foreach($findResult['data'] as $key=>$findData);
	// retrieve the recordID for the record you just found
	// several ways to do this: I just create a field in my database
called "recid", and it's a calc field equal to get(recordid)
	// you can also get the id another way, but I like this way better
	$recid = $findData['recid'][0]; // we retrieve the recid of the
record we just found

	// now that you got the recid you can now edit the record
	$myNewFieldValue = "the new value that I am going to store";
	
	// NOW we edit the record
	$edit = new FX('64.62.67.186','80','FMPro7');
	$edit->SetDBData('BG_Clients','BGDB Export');
	$edit->SetDBUserPass('Admin', 'iona');
	$edit->AddDBParam('-recid',$recid);
	$edit->AddDBParam('field_that_you_are_editing', $myNewFieldValue);
// write the new value for the field you're editing
	$editResult = $edit->FMEdit();
}else{
	include_once('your_error_page.htm'); // go to an error page }

That's it in a nutshell... :)

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
FileMaker 9 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060

--------------------------
Contact us for FileMaker hosting and programming for all versions of
FileMaker PHP . CDML . Full email services . Free DNS hosting . Colocation .
Consulting


On May 28, 2008, at 9:10 AM, CSInfo wrote:

> OK, I made some changes to my "page 2", it returns the correct data 
> and now I need to pass it to "page 3" and assign it to $recid. How?
>
> Please see my snippet of "page 3" code below:
>
> $recid = '10'; // hard coded but need to get id from post?
>
> $request = new FX('64.62.67.186','80','FMPro7'); 
> $request->SetDBData('BG_Clients','BGDB Export'); 
> $request->SetDBUserPass('Admin', 'iona'); 
> $request->AddDBParam('-recid', $recid); $result = $request->FMEdit();
>
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Jonathan 
> Schwartz
> Sent: Tuesday, May 27, 2008 10:55 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Basic help
>
> Sometimes very basic...isn't.
>
> This process involves 4 primary steps on three pages.
> 1) Log in Form (post method) PAGE 1
> 2) Log in Form Processing (FMFind) PAGE 2
> 3) Display Edit Form  (Post method) PAGE 2
> 4) Edit From Processing (FMEdit) PAGE 3
>
> First issue I see in your code is an attempt to use $_GET to process 
> the login. Shoudn't it be $_POST?
>
> Next, the Edit code below belongs on the last page. Page 2 is for 
> doing the query and then displaying the result to edit in a form.
>
> Also, here needs to addl code at the top of Page 2 to handle 
> unsuccesfull logins.
>
> Finally, Aas Alex states, you HAVE To have the -recid to edit the 
> record.
> You get that from the result of the query.
>
> Hope that helps.
>
> jonathan
>
>
> At 8:54 PM -0500 5/27/08, CSInfo wrote:
>> I am creating a very basic site to login by email and password, then 
>> edit or display the users info from their FM record. I am having a 
>> rough time getting the edit portion to work.I know the connection is 
>> valid, the display.php works fine. Below is my code for the edit.php 
>> page. Anybody care to debug? Sometime a second set of eyes help.
>> I can send the details.php if needed.
>> Thanks,
>> John Funk
>>
>>
>> <?php
>> include_once('FX/FX.php');
>> $Bride_Email=$_GET['Bride_Email']; // from the index page 
>> $Bride_Password=$_GET['Bride_Password'];
>>
>> //$Bride_Email='username'; //hard coded for testing as stand alone 
>> //$Bride_Password='pass'; //hard coded for testing as stand alone
>>
>> $groupSize='1';
>> $edit_account=new FX('64.62.67.186','80','FMPro7'); //this ip is only 
>> open to the website $edit_account->SetDBData('BG_Clients.fp7','BGDB
>> Export',$groupSize); $edit_account->SetDBPassword('iona','Admin');
>> $edit_account->AddDBParam( Bride_Email, $Bride_Email); 
>> $edit_account->AddDBParam( Bride_Password, $Bride_Password); 
>> $edit_accountResult=$edit_account->FMEdit();
>>
>> foreach($edit_accountResult['data'] as $key=>$edit_accountData);
>>
>> ?>
>> <html>
>> <head>
>>
>> </head>
>> <body>
>> <table>
>> <tr>
>> <td>Bride_Email</td></tr>
>> <tr><td><?php echo $edit_accountData['Bride_Last_Name'][0];
>> ?></td></tr> </table> <form name="edit" method="post"
>> action="details.php">
>>  <table>
>>    <tr>
>>      <th>Bride_Email</th>
>>      <td> <input type="text" name="Bride_Last_Name" value= <?php echo 
>> $edit_accountData['Bride_Last_Name'][0]; ?> /> </td>
>>    </tr>
>>    <tr>
>>      <th>&nbsp;</th>
>>      <td> <input type="submit" name="edit_submit" value="Submit" /> 
>> </td>
>>    </tr>
>>  </table>
>> </form>
>> <br>
>> </body>
>> </html>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> --
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> http://www.exit445.com
> 415-381-1852
> _______________________________________________
> 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