目前这是我的查询:$query_master = "SELECT DISTINCT * FROM `master_list` WHERE `plain_name` LIKE '%" . $searchterm . "%' OR `name` LIKE '%" . $searchterm . "%' OR `img` LIKE '%" . $searchterm . "%' OR `item_code` LIKE '%" . $searchterm . "%' OR `length` LIKE '%" . $searchterm . "%' ORDER BY `order_number`";但是,当我使用它时,它会拉动长度甚至部分匹配的项目。如何使长度部分完全匹配?我尝试将其更改为:$query_master = "SELECT DISTINCT * FROM `master_list` WHERE `plain_name` LIKE '%" . $searchterm . "%' OR `name` LIKE '%" . $searchterm . "%' OR `img` LIKE '%" . $searchterm . "%' OR `item_code` LIKE '%" . $searchterm . "%' OR `length` == '%" . $searchterm . "%' ORDER BY `order_number`";以几种不同的方式,它打破了页面。
1 回答
慕莱坞森
TA贡献1810条经验 获得超4个赞
只需删除长度字段的 (%) 运算符,
$query_master = "SELECT DISTINCT * FROM `master_list` WHERE `plain_name` LIKE '%" . $searchterm . "%' OR `name` LIKE '%" . $searchterm . "%' OR `img` LIKE '%" . $searchterm . "%' OR `item_code` LIKE '%" . $searchterm . "%' OR `length` LIKE '" . $searchterm . "' ORDER BY `order_number`";
认为它会帮助你。
- 1 回答
- 0 关注
- 76 浏览
添加回答
举报
0/150
提交
取消