Skip to content

Commit

Permalink
Fixed issue: Rowcount error when using List(Dropdown) question
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Oct 30, 2012
1 parent 5dad4be commit d88b12f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions application/helpers/qanda_helper.php
Expand Up @@ -1434,12 +1434,12 @@ function do_list_dropdown($ia)
} }


$ansresult = Yii::app()->db->createCommand($ansquery)->query() or safeDie('Couldn\'t get answers<br />'.$ansquery.'<br />'); //Checked $ansresult = Yii::app()->db->createCommand($ansquery)->query() or safeDie('Couldn\'t get answers<br />'.$ansquery.'<br />'); //Checked

$ansresult= $ansresult->readAll();
$dropdownSize = ''; $dropdownSize = '';
if (isset($aQuestionAttributes['dropdown_size']) && $aQuestionAttributes['dropdown_size'] > 0) if (isset($aQuestionAttributes['dropdown_size']) && $aQuestionAttributes['dropdown_size'] > 0)
{ {
$_height = sanitize_int($aQuestionAttributes['dropdown_size']) ; $_height = sanitize_int($aQuestionAttributes['dropdown_size']) ;
$_maxHeight = $ansresult->RowCount(); $_maxHeight = count($ansresult);
if ((!empty($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]])) && $ia[6] != 'Y' && $ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { if ((!empty($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]])) && $ia[6] != 'Y' && $ia[6] != 'Y' && SHOW_NO_ANSWER == 1) {
++$_maxHeight; // for No Answer ++$_maxHeight; // for No Answer
} }
Expand All @@ -1466,7 +1466,7 @@ function do_list_dropdown($ia)


if (!isset($optCategorySeparator)) if (!isset($optCategorySeparator))
{ {
foreach ($ansresult->readAll() as $ansrow) foreach ($ansresult as $ansrow)
{ {
$opt_select = ''; $opt_select = '';
if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == $ansrow['code']) if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == $ansrow['code'])
Expand All @@ -1483,7 +1483,7 @@ function do_list_dropdown($ia)
{ {
$defaultopts = Array(); $defaultopts = Array();
$optgroups = Array(); $optgroups = Array();
foreach ($ansresult->readAll() as $ansrow) foreach ($ansresult as $ansrow)
{ {
// Let's sort answers in an array indexed by subcategories // Let's sort answers in an array indexed by subcategories
@list ($categorytext, $answertext) = explode($optCategorySeparator,$ansrow['answer']); @list ($categorytext, $answertext) = explode($optCategorySeparator,$ansrow['answer']);
Expand Down

0 comments on commit d88b12f

Please sign in to comment.