diff --git a/core/classes/DbQuery.class.php b/core/classes/DbQuery.class.php index c36857bbe1..9355ac1d29 100644 --- a/core/classes/DbQuery.class.php +++ b/core/classes/DbQuery.class.php @@ -847,12 +847,15 @@ public function value( $p_index_or_name = 0) { } if( is_numeric( $p_index_or_name ) ) { if( count( $this->current_row ) > $p_index_or_name ) { - $t_value = reset( array_slice( $this->current_row, $p_index_or_name, 1 ) ); + # get the element at that numerical position + $t_keys = array_keys( $this->current_row ); + $t_value = $this->current_row[$t_keys[$p_index_or_name]]; } else { $t_value = false; } } else { if( isset( $this->current_row[$p_index_or_name] ) ) { + # get the value by column name $t_value = $this->current_row[$p_index_or_name]; } else { $t_value = false;