[FX.php List] Editing multiple records

Steve Winter steve at bluecrocodile.co.nz
Thu Aug 10 15:31:07 MDT 2006


Hi Rob,

I've just had a look at a page I wrote about 2 years ago to do the sort of
thing that you're looking at, and now, with everything I've learnt in the
last two years it looks pretty amateur, and pretty ugly, even to me and I'm
far from an expert, so I didn't want to go posting it on the mailing list...


I'll give it a bit of a tidy up tonight (I'm in Australia, so that's in
about 8 hours time, filemaker's my part-time 'out-of-hours' job) and post
something more professional on the list in time for your Friday morning...

The Ajax idea that someone else mentioned is also an excellent one, and I've
been doing quite a bit with the Ajax js classes from http://script.aculo.us/
(which includes a couple of nice php examples) and FM recently to good
effect...

Cheers
Steve

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Rob H.
Christensen
Sent: Friday, 11 August 2006 2:55 a.m.
To: fx.php_list at mail.iviking.org
Subject: [FX.php List] Editing multiple records

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


_______________________________________________
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