1.使用字符串作为查询条件:
$User=M('User');
$User->where('type=1 AND status=1')->select();生成语句:
select * from think_user where type=1 and status=1where()是sql查询方法的方法,select()是sql执行的方法
根据查询条件的不同,where()方法的参数可以是字符串,数组,对象
本文深入探讨了如何使用字符串作为查询条件,结合PHP与MySQL的M('User')方法进行高效SQL查询。通过实例展示了where()与select()方法的应用,以及根据查询条件的不同灵活设置参数的方法。
1.使用字符串作为查询条件:
$User=M('User');
$User->where('type=1 AND status=1')->select();select * from think_user where type=1 and status=1
被折叠的 条评论
为什么被折叠?