In a form (=data from table1) I want to update several field values with data from table2 via php plugin.
F.ex.: table2___userid -> table1___userid, table2___surname -> table1___surname ...
I tried with no success:
Could someone please help with an example, how to retrieve data from a db table and put them into the form fields?
F.ex.: table2___userid -> table1___userid, table2___surname -> table1___surname ...
I tried with no success:
PHP:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$meinUser = $formModel->formData['table1___userid'];
$query->select('*')->from('table2')->where('user = ' . $db->quote($meinUser));
$db->setQuery($query);
$ergebnis = $db->loadResult();
...
Could someone please help with an example, how to retrieve data from a db table and put them into the form fields?