Home >php教程 >PHP源码 >php自封装sql 中文like全or查询语句

php自封装sql 中文like全or查询语句

WBOY
WBOYOriginal
2016-06-10 15:03:031360browse
跳至 [1] [全屏预览]
function createlike($a,$b,$c=''){
	$d = '';
	$e = 'or';
	$f = count($a);
	for ($i=0; $i < $f; $i++) { 
		if ($i==$f-1) {
			$e = '';}
		$d.=($a[$i]." LIKE BINARY '%".$b."%' ".$e." ");
	}
	return $c.' ( '.$d.' ) ';}

createlike(['platform','Date','Team','addr','IP','domain'],$inf,'id!=0 and ');
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn