时间:2021-07-01 10:21:17 帮助过:42人阅读
MD()->debug()->get('items_want',['id'],[
'uid'=>74,
'item_id'=>28,
]);
//比如说上面这个,输出的sql居然是:SELECT "id" FROM "items_want" WHERE "uid" = 74 "item_id" = 28 LIMIT 1
而
MD()->debug()->get('items_want',['id'],[
'AND'=>[
'uid'=>74,
'item_id'=>28,
]
])
就能输出SELECT "id" FROM "items_want" WHERE "uid" = 74 AND "item_id" = 28 LIMIT 1
以下下MD()是我封装的提取 medoo的方法
MD()->debug()->get('items_want',['id'],[
'uid'=>74,
'item_id'=>28,
]);
//比如说上面这个,输出的sql居然是:SELECT "id" FROM "items_want" WHERE "uid" = 74 "item_id" = 28 LIMIT 1
而
MD()->debug()->get('items_want',['id'],[
'AND'=>[
'uid'=>74,
'item_id'=>28,
]
])
就能输出SELECT "id" FROM "items_want" WHERE "uid" = 74 AND "item_id" = 28 LIMIT 1
对的,因为要处理 AND 和 OR 的关系,所以这种方式还是比较符合逻辑的
medoo多条件必须用and,具体看他官网或源代码