Since I installed joomla 3.8.0 items are inserted twice in the database. I tried several methods and nothing works:
// method 1
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$profile = new stdClass();
$profile->modif_id = $modif_id;
$profile->product_id= $ajout_prod_id;
$profile->nombre= $ajout_prod_number;
$result = $db->insertObject('mytable', $profile);
//method 2
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = "INSERT INTO mytable
(modif_id, product_id, nombre) VALUES ('".$modif_id."', '".$ajout_prod_id."', '".$ajout_prod_number."')";
$db->setQuery($query);
$db->execute($query);
Item inserted in the database only once
Item inserted twice in the database
Joomla 3.8.0
Regular Labs - Sourcerer 7.1.9
Everything was working well before the 3.8.0 update. It has been stable for years.
Unless this code is being run in a plugin (there's nothing here giving context of where the insert query is being executed, the only possible pointer is they explicitly listed Sourcerer in their report), that issue wouldn't affect the database API as the database has no events.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-09-28 13:46:17 |
Closed_By | ⇒ | Gorzin |
The code was executed in a plugin that was executed twice. I had to change an include to include_once.
Thanks for the quick replies
This is possibly the plugin firing twice issue reported before.