static function where($array, $method = 'AND')
{
if (!is_array($array)) {
return $array;
}
$output = array();
foreach ($array as $field => $value) {
$output[] = $field . ' = \'' . self::escape($value) . '\'';
$separator = ' ' . $method . ' ';
}
return implode(' ' . $method . ' ', $output);
}