[FX.php List] Editing multiple records

Rob H. Christensen robhelleshoj at tiscali.dk
Thu Aug 10 10:55:16 MDT 2006


Hi Steve
It is something like that I had in my mind. Still have to work out the
details though. It should not be that big a problem to loop through the
records 20, 30, 40 or 50 at a time depending on the groupsize and create a
list with pop-up fields. I can see what you are aiming at, and I will start
experimenting as soon as I can get my spare machine set up with a copy of
the database running.  There might be a problem with skips ( the one I use
now only works, when nothing is edited) but that is just a question of
finding out how to write the proper values for the links in the next and
previous buttons. The only things which have to go into the array are the
new value of the pop-up field with the record ID as its key I think. No
other data is changeable in this list.

When updating the database with a loop, the key is used to identify the
record and the date is set from its corresponding value.

I hope that works fast enough. The users of this database, which tracks jobs
and job-progress, are an impatient lot.

I have been looking around for some examples (I am not that experienced a
programmer - too many long pauses between writing code) but until now I have
not found any, so I would like to have a look at your code.

Rob

> Hi Rob,
> 
> In a way you've answered the question yourself... a foreach loop...
> 
> In the foreach loop that you use yo output the data, instead of outputting
> a new form for each item, output a hidden field containing the recID of
> the record, plus the other data... appending [] to the end of each name
> item (so that it becomes something like <input name="-recid[]"
> value="<?php echo $recordID; ?>"> etc... this way you end up with arrays
> for each of the records.
> 
> I'd also add a final hidden field, that contained the
> $returnedData['foundCount'] so that you knew how many records you were
> editing...
> 
> Once you've submitted the form, you then use that data to loop through the
>  posted data, so something like (pseduo, untested code)
> 
> foreach($i=0, $i<$_POST['foundCount'], $i++) {
>   $updateRecord->NewFX etc etc
>   $updateRecord->AddDBParam('-recid',$_POST['-recID'][$i])
>   $updateRecord->AddDBParam('dataOne',$_POST['dataOne'][$i])
>   $updateRecord->AddDBParam('dataTwo',$_POST['dataTwo'][$i])
>   // etc etc
>   }
> 
> I'm not in a position to build you a working demo just now, but I have
> code that does exactly this I can send you later in the day if you can't
> get it to work ;-)
> 
> Cheers
> Steve
> 
> 
> When you submit the form




More information about the FX.php_List mailing list