[Typo3] saving data in two tables in BE

Steven Bagshaw steven.bagshaw at unv.org
Mon Jun 20 13:48:08 CEST 2005


To do this I created a hook class.

See http://typo3.org/development/articles/how-to-use-existing-hooks/

Here's an example from my class. You should probably use the same function
name to do what you're seeking to do.

function processDatamap_preProcessFieldArray(&$fieldArray, $table, $id,
&$reference)
  {
    global $TSFE, $_POST, $TYPO3_DB;

   //do something if we save an existing record from the table called
mytable_name
   if ($table == 'mytable_name' && $id > 0)
    {
      $updateFields = array();
      $updateFields['redundant_dibody'] = $fieldArray['body'];

      $TYPO3_DB->exec_UPDATEquery("anothertable",
                                  "uid = " . $fieldArray['foreignkeyid'] .
                                  " and redundant_dilanguage = " .
$fieldArray['language'],
                                  $updateFields);
    }
}

You can do this for any table. See the URL I sent for more specifics on how
to get your hook registered. Post back if you need more info.

Steven


"Bart Aninowski" <bart at sonik.pl> wrote in message
news:mailman.1.1119031295.13657.typo3-english at lists.netfielders.de...
> Hi
> We are developing some kind of products catalog for our website.
> We have one table which store common information like id picture size
> quantity category etc.
> Specific data for particular product we keep in separte tables fg
> products_cd, product_notebook etc.
> How can we save data into two table while adding new item in BE. Our BE
form
> contains fileds for common and specific info.
> Can you give me a hint?
>
> bartus
>
>





More information about the TYPO3-english mailing list