tp6.0 query statement becomes like this? ?
文
2019-06-26 16:07:42
0
1
1224
$data = $this->request->post();
$where = [];
$where['status'] = 1;
$map['name'] = ['like','%'.$data['goods_name'].'%'];
$goods_list = Db::name('mall_goods')->where($map)->order($order)->select();

Query error. . . Print the sql statement and find that it is like this:

"SELECT * FROM `tp_mall_goods` WHERE `status` = 1 AND `name` IN ('like','%发%')"

tp5 supports such query. The following is the same sql statement for tp5:

"SELECT * FROM `tp_mall_goods` WHERE `status` = 1 AND `name` LIKE '%发%'"

文

reply all(1)
殘留の回憶

thinkphp5 is like this, where('name', 'like', 'php')-

The form of the array is this, $where['name'] =array('like ',array('%1%','%2%'),'OR')

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!