results =& $results; $this->map = array(); $num_fields = mysql_num_fields($results); $index = 0; $j = 0; while ($j < $num_fields) { $column = mysql_fetch_field($results,$j); if (!empty($column->table)) { $this->map[$index++] = array($column->table, $column->name); } else { if (strpos($column->name, '__')) { $parts = explode('__', $column->name); $this->map[$index++] = array($parts[0], $parts[1]); } else { $this->map[$index++] = array(0, $column->name); } } $j++; } } }