Adding user data to own table; PHP 8

TonyMJ

New Member
Hi,
I have a table I created within the Joomla schema that I want to populate with data from a form, including some user data that's available to the form via the user plugin. In the past, I've used this code in the PHP plugin (at the start of form submission):

$myDb = JFactory::getDbo();
$userid = $formModel->getElementData('my_table___user_id',true);
$userid = is_array($userid) ? $userid[0] : $userid;
$myQuery = $myDb->getQuery(true);
$myQuery
->select(array('name', 'email'))
->from('joom01_users')
->where('id = ' . $myDb->quote($userid));
$myDb->setQuery($myQuery);
$row = $myDb->LoadObject();
$formModel->updateFormData('my_table___user_name', $row->name);
$formModel->updateFormData('my_table___email', $row->email);
return true;


It used to work fine. Under PHP 7.4 data are stored in the table (but not the ones filled in by this PHP fragment). Under PHP 8.0, I get a success message, but nothis is added to the table.

Is ther a simple way of doing this that will work under PHP 8?
 
Do you have enabled Joomla's error reporting to get warnings etc?

Gesendet von meinem SM-G930F mit Tapatalk
 
Have updated today from github. That's sorted some problems. Error reporting on maximum shows no errors, but nothing save to table either.
 
Then next, debug your code by looking at what you're getting for $userid, $myQuery, $row with var_dump or print_r, and exit.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top