marcelf
Member
Hi,
I am developing a Form Plugin and need to insert another record in a list.
Is there a function to pass the parameters and it creates the record correctly?
I've seen the code below being used, but I must to create a complex record with dabasejoin, fileuploads ajax uploads, rating, and other elements, so I don't want to treat each element plugin.
Any help will be apreciated.
Thanks,
Marcel
Insert a record in another table and update a form's field with the records primary key(top)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->insert('tablename')->set('field = ' . $db->quote('bar'))
->set('field2 = ' . $db->quote('{tablename___elementname}'));
$db->setQuery($query);
$db->execute();
$id = $db->insertid();
I am developing a Form Plugin and need to insert another record in a list.
Is there a function to pass the parameters and it creates the record correctly?
I've seen the code below being used, but I must to create a complex record with dabasejoin, fileuploads ajax uploads, rating, and other elements, so I don't want to treat each element plugin.
Any help will be apreciated.
Thanks,
Marcel
Insert a record in another table and update a form's field with the records primary key(top)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->insert('tablename')->set('field = ' . $db->quote('bar'))
->set('field2 = ' . $db->quote('{tablename___elementname}'));
$db->setQuery($query);
$db->execute();
$id = $db->insertid();