Newbies heldopslippers Posted May 6, 2008 Newbies Posted May 6, 2008 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 ?
Genx Posted May 7, 2008 Posted May 7, 2008 $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); }
Recommended Posts
This topic is 6304 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 accountSign in
Already have an account? Sign in here.
Sign In Now