即日起在codingBlog上分享您的技术经验即可获得积分,积分可兑换现金哦。

thinkphp初步入门基础知识

编程语言 u013685199 10℃ 0评论

1.查询

$m=M(“material_stored”);

   $name=$_POST[“material_name”];





        if($name!=””){


   $where1[“material_name”]=array(like,”%$name%”);


   } 





   


    


        


   $where1[‘material_stored.matState’]=1;


   $sql11=”LEFT JOIN material_stored ON (new_mat_add.material_id=material_stored.material_idhao)”; //主表id=附表id


  //需要的 字段


   $field1=”material_stored.material_idhao as material_idhao,material_stored.material_name as  material_name,material_stored.material_describe as material_describe,material_stored.matState as matstate,


        new_mat_add.add_time as add_time,


        mat_type.mattype_name as mattype_name,


    user.user_name as user_name”;


         


$matHisAdd=M(‘new_mat_add’)->join($sql11)->join($sql12)->join($sql13)->where($where1)->field($field1)->order(‘material_stored.material_idhao desc’)->select();


$this->assign(‘matHisAdd’,$matHisAdd);


转载请注明:CodingBlog » thinkphp初步入门基础知识

喜欢 (0)or分享 (0)
发表我的评论
取消评论

*

表情