普通查询除了字符串查询条件外,数组和对象方式的查询条件是非常常用的,这些是基本查询所必须掌握的。 一、使用数组作为查询条件 $User = M("User"); //实例化User对象 $condition['name'] = 'thinkphp'; // 把查询条件传入查询方法 $User->where($condition)->select(); 二、...
Tag Archives: Thinkphp
thinkphp查询方法
2012.11.30 , php技术, Thinkphp , 2 Comments ,thinkphp关联查询
2012.11.30 , php技术, Thinkphp , 3 Comments ,两个表的关联查询: $M_shopping = M('Shops'); $M_product = M('Product'); $list_shops = $M_shopping->join('as shops left join hr_product as product on shops.product_id = product.p_id') ->...
thinkphp实现无限极分类
2012.11.11 , php技术 , 14 Comments ,首先看数据库表:xp_cate 控制器: CateAction.class.php <?php class CateAction extends Action{ function index(){ $cate=M('Cate'); $list=$cate->field("id,name,pid,path,concat(path,'-',id) as...