May 6, 200817 yr Newbies 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 ?
May 7, 200817 yr $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); }
Create an account or sign in to comment