Posted in PHP onMarch 24, 2009
//生成where字符串 function get_where($arg = null) { foreach ((array)$arg as $key => $val) { if(is_int($key)) { $where .= " $val "; }else { if(is_string($val)) { if($val === null) { $where .= " and $key is null "; }else { $where .= " and $key = '$val' "; } }elseif(is_array($val)) { foreach ($val as $v) { if(is_string($v)) { $in .= $in ? ",'$v'" : "'$v'"; }else { $in .= $in ? ",$v" : "$v"; } } $where .= " and $key in ($in)"; }else { $where .= " and $key = $val "; } } } return $where; }
php SQL之where语句生成器
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@