技术QQ交流群:294088839
1. 例:
//拼接sql语句 减少数据库压力
$sql="insert into aa_cc(name,password,endtime,time,user_name,attach,goods_name) values";foreach($data as $v){
$sql.="('".$v['name']."','".$v['password']."',".$v['endtime'].",".$v['time'].",'".$v['user_name']."','".$v['attach']."','".$v['goods_name']."'),";
}
$sql=substr($sql,0,strlen($sql)-1);
$sql.=';';
$cc=M();
2. in 关键字
$where['username']=array('in',$arr);
$count = $Online->where($where)->where('acctstoptime is null')->count();
某个字段中是否值是否存在于某个数组中
3.搜索优化 用join 增加索引 索引类型分为Unique 和Nomalh和Full text 索引方法 btree和hash 尽量不适用like 一般用LOCATE()代替 %和两个% 的查询速度不一样