[FX.php List] Problems on a looping edit RESOLVED

John Funk jfunk at criticalsolution.com
Thu Apr 2 14:10:32 MDT 2009


I am not really sure why I used while (it worked so why change), this was
old code that I picked up from another project.

I did get the edit to work, I put in some if statements to check the data
for changes and only edit if there is a change. Not sure what this will do
if I have 200 changes....I will see....
I also set the $groupSize to the $foundcount of the submission page, this
seems to do the trick.
New Code:

$foundCount = $_REQUEST["foundCount"];
$groupSize=$foundCount;
$x = 1;
while ($x < $foundCount)
{
$myRecID = $_REQUEST["recID_".$x];
$S = $_REQUEST["S".$x]; // this is a field in FileMaker that checks if there
is data in the two other fields
$M = $_REQUEST["M".$x];
$D = $_REQUEST["D".$x];
if($S=="1" or $M=="M" or $D=="D") // only write data if there is something
selected od there was data originally
{
$request = new FX($ServerIP, '80', 'FMPro7');
$request->SetDBData($db,'web_products_selected',$groupSize);
$request->SetDBUserPass($fmAccount, $fmPass);
$request->AddDBParam('-recid', $myRecID);
$request->AddDBParam('Manufacturer', $M);
$request->AddDBParam('Distributor', $D);
$result = $request->FMEdit();
//echo $myRecID."  ".$M." ".$D."<br>"; // this line is for debugging
}
$x++;
}

THANKS TO ALL!!!!



On 4/2/09 2:40 PM, "Gjermund Gusland Thorsen" <ggt667 at gmail.com> wrote:

> Hmm, why do you specify groupsize as string? and x as value?
> 
> I have no clue why you do not use foreach...
> 
> http://pastebin.com/f5f510e64
> 
> and it would be nice to see the data you put into the loop
> 
> ggt
> 
> 2009/4/2 John Funk <jfunk at criticalsolution.com>:
>> I have a page with a list of check boxes, when the page gets submited the
>> data is read from the request and written to FileMaker. So far so good. But
>> for some unknown reason the FMEdit() function stops short of the
>> foundcount.( I need to edit as many as 200 in a loop)
>> When I comment out the lines that perform the edit, the page runs complete.
>> Is there a time out that I need to change or is there something wrong with
>> my code:
>> $foundCount='0';
>> $groupSize='1';
>> 
>> $foundCount = $_REQUEST["foundCount"];
>> $x = 1;
>> while ($x < $foundCount)
>> {
>> $myRecID = $_REQUEST["recID_".$x];
>> $M = $_REQUEST["M".$x];
>> $D = $_REQUEST["D".$x];
>> echo $myRecID."  ".$M." ".$D."<br>";
>> $request = new FX($ServerIP, '80', 'FMPro7');
>> $request->SetDBData($db,'web_products_selected',$groupSize);
>> $request->SetDBUserPass($fmAccount, $fmPass);
>> $request->AddDBParam('-recid', $myRecID);
>> $request->AddDBParam('Manufacturer', $M);
>> $request->AddDBParam('Distributor', $D);
>> $result = $request->FMEdit();
>> echo $myRecID."  ".$M." ".$D."<br>"; // this line is for debugging
>> $x++;
>> }
>> 
>> Any ideas?
>> John Funk
>> _______________________________________________
>> 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