// $conditions 保存查询条件
$conditions = 'level_ix > 1';
// $tableOrders 是一个订单数据表的表数据入口对象
$order = $tableOrders->find($conditions, 'created DESC', 'id, title, body');
$conditions = array('username' => 'dualface');
// $tableUsers 是一个用户信息数据表的表数据入口对象
$user = $tableUsers->find($conditions);
// 查询主键字段值为1的记录 $user = $tableUsers->find(1); // 如果主键字段名为"id",则生成的where字句为"WHERE `id` = 1"
$conditions = 'id < 3' $user = $tableUsers->find($conditions); //生成的where字句为"WHERE id < 3"
// 查询id字段值为3的记录 $conditions = array( 'id' => '1', ); $user = $tableUsers->find($conditions); //生成的where字句为"WHERE `id` = 1"
$conditions = array('id = 1');
// 生成的where字句为"WHERE `id` = 1"
$user = $tableUsers->find($conditions);
$conditions = array( 'id < 3', 'sex' => 'male', ); $user = $tableUsers->find($conditions); // 生成的where字句为"id < 3 AND `sex` = 'male'"
// 假如主键名为"id",需要查询id的值为1、2、3其中之一,则可以这样写: $condition = array( 'in()' => array(1,2,3), ) $user = $tableUsers->find($conditions); // 生成的where子句为"WHERE `id` IN (1, 2, 3)"
$condition = array(
'in()' => array(
'username' => array('username1','username2')
)
)
$user = $tableUsers->find($conditions);
// 生成的where子句为"WHERE `username` IN ('username1', 'username2')"
$fields = array('title', 'created');
//也可以写成下面的字符串形式,两种写法作用相同,区别在于自动生成的字段名两边将会添加上"`"符号,以防止出现字段名与SQL关键字冲突的情况出现。建议手写时也加上"`"字符
$fields = 'title, created';
$user = $tableUsers->find('id < 10',NULL,$fields);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有