I'm having some issues with a simple select query. This query is generated by the core files, I haven't created any overrides or changed the code.
administrator/components/com_fields/models/field.php around line 668 the query looks like this;
$query->select(array($query->qn('field_id'), $query->qn('value'))) ->from($query->qn('#__fields_values')) ->where($query->qn('field_id') . ' IN (' . implode(',', ArrayHelper::toInteger($fieldIds)) . ')') ->where($query->qn('item_id') . ' = ' . $query->q($itemId));
In my contacts component, I have dumped this query and it produces the following;
SELECT `field_id`,`value` FROM `o3m0z_fields_values` WHERE `field_id` IN (17) AND `item_id` = '119'
The results of this are
When I copy / paste this query into HeidiSql the results are also zero.
However, whenever I remove the single quotes around
119, I get results!
So the updated query looks like this;
SELECT `field_id`,`value` FROM `o3m0z_fields_values` WHERE `field_id` IN (17) AND `item_id` = 119
Why does the first query fail and the second query succeed?
How can I edit the original Joomla query so that it doesn't add single quotes to the query?
I know this is editing core files which I should never do, but it's causing all sorts of issues when I'm editing contacts with custom fields.