All pastes #490225 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-15 22:12 UTC
rendered paste body
function _where($key, $value = NULL, $type = 'AND ')
	{
		if ( ! is_array($key) and $value != NULL)
		{
			$key = array($key => $value);
		}
 	 	
		if (is_array($key))
		{
			foreach ($key as $k => $v)
			{
				$prefix = (count($this->ar_where) == 0) ? '' : $type;
				
				if ( ! is_null($v))
				{
					if ( ! $this->_has_operator($k))
					{
						$k .= ' =';
					}
				
					$v = ' '.$this->escape($v);
				}
							
				$this->ar_where[] = $prefix.$k.$v;
			}
		}
		else
			$this->ar_where[] = $key;
			
		return $this;
	}