$query = "
SELECT label, value
FROM civicrm_option_value
- WHERE option_group_id = {$dao->optionGroupID}
+ WHERE option_group_id = %1
";
- $option = CRM_Core_DAO::executeQuery($query);
+ $option = CRM_Core_DAO::executeQuery($query, array(1 => array($dao->optionGroupID, 'Positive')));
while ($option->fetch()) {
$dataType = $dao->dataType;
if ($dataType == 'Int' || $dataType == 'Float') {
foreach ($sql as $tableName => $values) {
$columnNames = implode(',', $values);
+ $tableName = CRM_Utils_Type::escape($tableName, 'MysqlColumnNameOrAlias');
$sql[$tableName] = "
-SELECT '{$groupTitle[$tableName]}' as groupTitle, $columnNames
+SELECT '" . CRM_Core_DAO::escapeString($groupTitle[$tableName]) . "' as groupTitle, $columnNames
FROM $tableName
WHERE entity_id = %1
";