Skip to content

Commit

Permalink
Dev: Use try-catch block for potential faulty query in statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt authored and LouisGac committed Aug 28, 2017
1 parent 80ac62d commit 3f57f03
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion application/helpers/admin/statistics_helper.php
Expand Up @@ -2555,7 +2555,12 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
if (!empty($sql)) {$query .= " AND $sql";}

//get data
$row=Yii::app()->db->createCommand($query)->queryScalar();
try {
$row=Yii::app()->db->createCommand($query)->queryScalar();
} catch (Exception $ex) {
$row = 0;
Yii::app()->setFlashMessage(gT('Faulty query: ') . $query, 'error');
}

//store temporarily value of answer count of question type '5' and 'A'.
$tempcount = -1; //count can't be less han zero
Expand Down

0 comments on commit 3f57f03

Please sign in to comment.