function get($table, $opt) { $t = DB_DataObject::factory($table); if (is_array($opt)) { $wheres = array(); foreach ($opt as $key => $value) { $wheres[] = "{$key} = " . $t->escape($value); } $results = DBUtils::find($table, implode(' AND ', $wheres)); if (count($results) == 1) { return $results[0]; } else { return $results; } } else { $t->get($opt); return $t; } }