[FX.php List] Updating repeating field with AddDBParam

Jon Montgomery vicepresident at onecliq.net
Wed Aug 9 11:56:55 MDT 2006


On 8/9/06 8:05 AM, "Jack Kelly" <jlk4p at virginia.edu> wrote:

> Folks,
> 
> I've just started using the FX.php module and I'm having trouble
> finding info regarding how to properly qualify updating a repeating
> field when working with FM5/6.
> 
> I tried just specifying the same parameter and repeating the value
> thinking it would understand that the same field indicated a
> repeating value which did not work:
> 
> ...
> foreach ($_POST['viewTypes'] as $key => $value) {
>     $imageQuery->AddDBParam('View Type',$value);
> }
> ...
> 
> And I tried using a format based on what the documentation said was
> needed when working with FM7 repeating/portal fields which does not
> work:
> 
> ...
> $i = 1;
> foreach ($_POST['viewTypes'] as $key => $value) {
> $imageQuery->AddDBParam("View Type($i)",$value);
> $i++;
> }
> ...
> 
> I tried the above with i=0 and i=1. And tried adding ".$recId" after
> the ($i). Neither worked.
> 
> Does anyone know how I correctly specify repeating fields using the
> AddDBParam method with a FM5/6 database?
> 
> Thanks in advance,
> Jack
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 

Jack,
    Most of the posts on here are just above me, so not sure if this will
help or not.  After reading Chris Hansen's post you may not need this info
and it may be all wrong.  But I get so much info from all of the posts and
this is the first one that maybe, just maybe I can contribute back.

    I have successfully managed to enter data in repeating fields in a FMP 7
file. So this may work for you also.  I also know, as we say in Southern
Illinois, "there is more than one way to skin a cat!"  (No offence to cat
lovers here, it is just an expression.).  So this might not be the best way
to code it, but it does work.  And any help from the more experienced coders
out there would be greatly appreciated!
    In the data base that I am using FX.PHP to enter data on the web with,
there are repeating fields for first name and last name.  As many as 20
names can be submitted for one record.
    I tried what you listed a time or two I think.  (I am new to this coding
and really miss the drag and drop method!)  I had no luck.  So here is what
finally worked.  If you cannot understand what I have done, that might be
par for the course.  I know enough to be dangerous.

    Here is the code for adding a record to data base with repeating fields:

Posts from previous page sent via Record ID

$Accompanist=$_POST['Accompanist'];
$Fname1=$_POST['Fname1'];
$Fname2=$_POST['Fname2'];
$Fname3=$_POST['Fname3'];
$Fname4=$_POST['Fname4'];

Ans so on...
$Lname1=$_POST['Lname1'];
$Lname2=$_POST['Lname2'];
$Lname3=$_POST['Lname3'];
$Lname4=$_POST['Lname4'];

And so on.....


$edit=new FX($serverIP,$webCompanionPort);
$edit->SetDBData('Manager_IHSA.fp7','Data Entry');
$edit->AddDBParam('-recid',$recid);
$edit->AddDBParam('Lname[1]',$Lname1);
$edit->AddDBParam('Lname[2]',$Lname2);
$edit->AddDBParam('Lname[3]',$Lname3);
$edit->AddDBParam('Lname[4]',$Lname4);
And so on....

$editResults=$edit->FMEdit();

I have used this to help me see what the data base is doing with the info:
define('DEBUG', true);
You can turn this on by changing the false to true at the top of the FX.php
file.  Then you will get a URI link if it works it will display what was
returned by the database...see if it took the edits.

Code for displaying multiple fields.  Notice that the first repitition is
marked [0] and the second is marked [1] which is different from the way you
get the data in to the repeating fields.  Don't know why it is this way, but
it works for me.

  <th scope="row"><input name="Fname1" type="text" id="Fname1" value="<?php
echo $editfindData['FName'][0]; ?>"></th>
    <td><input name="Lname1" type="text" id="Lname1" value="<?php echo
$editfindData['LName'][0]; ?>"></td>
  </tr>
  <tr>
    <th scope="row"><input name="Fname2" type="text" id="Fname2"
value="<?php echo $editfindData['FName'][1]; ?>"></th>
    <td><input name="Lname2" type="text" id="Lname2" value="<?php echo
$editfindData['LName'][1]; ?>"></td>
  </tr>
  <tr>

And so on.....

I hope this helps you....and if anyone can tell me how to save time, I am
all ears.

Thanks for the list!

Jon Montgomery

-- 
Jon W. Montgomery, Vice President and WebMaster
Illinois Grade School Music Association ­ Southern Division
Email at: vicepresident at onecliq.net
School email at : jwmontgomery at dqud300.perry.k12.il.us
Web Site:  www.igsmasouth.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060809/50b50861/attachment-0001.html


More information about the FX.php_List mailing list