I've come across this error when performing some database queries in my J4 site model:
$db->setQuery((string)$query);
try {
$rows = $db->loadObjectList();
} catch (RuntimeException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(),'danger');
return false;
}
Then I do some stuff with the output called $rows and then based on the result of this "stuff" (ie a ref_id) I try to update all the records that were returned in $rows using:
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->clear();
$query = ' UPDATE #__my_table_name SET state = 5, ref_id = '.(int) $ref_id.' WHERE user_id = '.(int) $user->id.' AND state = 1 ';
$db->setQuery((string)$query);
try {
$result = $db->loadResult();
return true;
} catch (RuntimeException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(),'danger');
return false;
}
The "stuff" being done has nothing to do with the database, just tweeking some text files, so why is it saying I'm out of sync? Is there a new step required here? Any and all help greatly appreciated. Cheers.
UPDATE
query, I think you need to replace$result = $db->loadResult();
with$result = $db->execute();