value * 2 columns 1st value => 2nd value * 3 or more 1st value => array(2nd value, 3rd value, ...) */ function db_result_array($result) { $array = array(); while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) { $y = count($row); switch ($y) { case 0: drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error'); return false; case 1: $array[$row[0]] = $row[0]; break; case 2: $array[$row[0]] = $row[1]; break; default: $array[$row[0]] = array_slice($row, 1); break; } } return $array; }