目前這是我的查詢:$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`";但是,當(dāng)我使用它時(shí),它會(huì)拉動(dòng)長度甚至部分匹配的項(xiàng)目。如何使長度部分完全匹配?我嘗試將其更改為:$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貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
只需刪除長度字段的 (%) 運(yùn)算符,
$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`";
認(rèn)為它會(huì)幫助你。
- 1 回答
- 0 關(guān)注
- 110 瀏覽
添加回答
舉報(bào)
0/150
提交
取消