#1 swhmail@126.com
if (is_array($conditions)){
$join = array();
foreach ($conditions as $key => $condition)
{
$condition = $this->escape($condition);
$join[] = "{$key} = {$condition}";
}
$where = "WHERE ( " . join(" AND ", $join) . ")";
} else
{
if (null != $conditions)
$where = "WHERE ( " . $conditions . ")";
}
更改为
if (is_array($conditions))
{
$join = array();
foreach ($conditions as $key => $condition)
{
$condition = $this->escape($condition);
if ($key)
$join[] = "{$key} = {$condition}";
else
$join[] = "{$condition}";
}
$where = "WHERE ( " . join(" AND ", $join) . ")";
} else
{
if (null != $conditions)
$where = "WHERE ( " . $conditions . ")";
}
就应该可以处理如下条件
$condition= array('id'=>3,'age>15')
2012-04-28 12:09:48