Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

Hi All

I have 2 tables:

Article

Article_Rights

When i want to create a article I want to use that ID in Article_rights to create Rights for that Article

This is what I have for creating the article:


$request = $GLOBALS['db']->newAddCommand("Article");

$request->setField('Parent_ID', $id);

$request->setField("head", $head_value);

$request->setField("tekst", $tekst_value);

$request->execute();

But how do I get the ID or create a related record in Article_Rights.. Within the same query or something ?

Posted

$request = $GLOBALS['db']->newAddCommand("Article");

$request->setField('Parent_ID', $id);

$request->setField("head", $head_value);

$request->setField("tekst", $tekst_value);

$result = $request->execute();



if( !FileMaker::isError($result) ) {

    $article_id = $result->getFirstRecord()->getRecordId();

    $request = $GLOBALS['db']->newAddCommand("Article_Rights");

    $request->setField('Parent_ID', $article_id);

}

This topic is 6036 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.