Jump to content
Server Maintenance This Week. ×

Adding records through portal by using FX.php


This topic is 7035 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hope you all are doing well. I just have a quick question related to the

portal relationship:

I have two related tables (Reference and Author) and the name of the

relationship is "Authors" and I have a portal on the Reference layout

which shows some fields from the Author table !!

Now my question is I am trying to add a new record into the Reference

table and at the same time I want to add the corresponding authors into

the Authors table too by using that portal ...so I am trying to write my

query string something like:

$create->AddDBParam('Authors::Author.1',$_POST['Author1']);

OR something like this (if I want to add multiple records):

for($i=1;$i<=$authornumber;$i++){

$create->AddDBParam('Authors::Author.'.[$i-1],$_POST['Author'.$i]);

}

but it doesn't work !!! give me an error#101 : Does anyone has anyideato solve this problem?? I would really appreciate for any help !! Hope to hear from you guys soon. Thanks a lot.

Sincerely,

Ankur

Link to comment
Share on other sites

Thanks for the reply Garry !! I really appreciated it, it works great only if I just want to add one row !! But again it gives me same error (#101), if I want to add more then one row/record to a portal.

For first row, I tried: (it works fine)

$create->AddDBParam('Authors::Author.0',$_POST['Author1']);

So I thought may be for second row, I should try someting like:

$create->AddDBParam('Authors::Author.1',$_POST['Author1']);

but it doesn't work !! may be because as you said "Any other numbers will edit the row", So I was just wondering if you have any other idea to add multiple records through portal ?? Thanks for your time and help.

Sincerely,

ankur

Link to comment
Share on other sites

Thanks again !! Actually I tried in the loop too:

ex1:

$create->AddDBParam('Taxon',$Taxon);

$create->AddDBParam('PdfName',$PdfName);

$create->AddDBParam('pdftextsearch',$pdftextsearch);

$create->AddDBParam('URL',$URL);

for($i=1;$i<=$authornumber;$i++){

$create->AddDBParam('Authors::Author.'.($i-1),$_POST['Author'.$i]);

}

$createResult=$create->FMNew();

but it didn't work !! So I tried to fix "Authors::Author.0" and I wrote something like:

ex2:

for($i=1;$i<=$authornumber;$i++){

$create->AddDBParam('Authors::Author.0',$_POST['Author'.$i]);

}

I got an interesting result, I didn't get any error but all the authors values came into the first row(first record) with a line break !! rather than creating a new record for the second author and onwards !!!

Do you know, how can we create a new record (more than one) through portal in a relationship ?? Any idea or help would be greatly appreciated !! Thanks guys !!!

Sincerely,

Ankur

PS: please see the attched file, Thanks !!

Picture6.pdf

Link to comment
Share on other sites

This topic is 7035 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.