Permalink
Browse files

Fixed issue: Rowcount error when using List(Dropdown) question

  • Loading branch information...
1 parent 5dad4be commit d88b12fba05778c374e36e247d26a498340ebc75 @c-schmitz c-schmitz committed Oct 30, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 application/helpers/qanda_helper.php
View
8 application/helpers/qanda_helper.php
@@ -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= $ansresult->readAll();
$dropdownSize = '';
if (isset($aQuestionAttributes['dropdown_size']) && $aQuestionAttributes['dropdown_size'] > 0)
{
$_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) {
++$_maxHeight; // for No Answer
}
@@ -1466,7 +1466,7 @@ function do_list_dropdown($ia)
if (!isset($optCategorySeparator))
{
- foreach ($ansresult->readAll() as $ansrow)
+ foreach ($ansresult as $ansrow)
{
$opt_select = '';
if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == $ansrow['code'])
@@ -1483,7 +1483,7 @@ function do_list_dropdown($ia)
{
$defaultopts = Array();
$optgroups = Array();
- foreach ($ansresult->readAll() as $ansrow)
+ foreach ($ansresult as $ansrow)
{
// Let's sort answers in an array indexed by subcategories
@list ($categorytext, $answertext) = explode($optCategorySeparator,$ansrow['answer']);

0 comments on commit d88b12f

Please sign in to comment.