Hello! I need to save comments count to the article field.
For this purpose I've tried to create a Sync entry looking like this and with the code (field_id is 12) :
But the result of this code is nothing and the log is "entry_updated: Column count doesn't match value count at row 1".
How should I save comments count to the article field with field_id 12?
For this purpose I've tried to create a Sync entry looking like this and with the code (field_id is 12) :
<?php
$columns = ['field_id', 'item_id', 'value'];
// $data = [12, $object_id, $comment_count];
$data = [12, 42, 4];
$query = $db->getQuery(true)
->insert($db->qn('#__fields_values'))
->columns($db->qn($columns))
->values($data);
//$db->setQuery(substr_replace($query, 'REPLACE ', 0, 8)); // swap INSERT for REPLACE
$db->setQuery($query);
$db->execute();
?>
[font=Helvetica, sans-serif][/font]
But the result of this code is nothing and the log is "entry_updated: Column count doesn't match value count at row 1".
How should I save comments count to the article field with field_id 12?