[英]No results are returned when using Like in sql query
我在使用 PHP 時遇到了 MySQL 的語法問題。
我的代碼:
$q['item_desc LIKE \'%?%\'"'] = array($criteria);
但它被轉換為 SQL 查詢:
SELECT `Item`.`id`, `Item`.`item_desc`, `Item`.`row_num`, `Item`.`shelf_num`, `Item`.`shelf_loc`, `Item`.`datetime` FROM `inventory`.`items` AS `Item` WHERE `item_desc` LIKE '%'10'%'"
我相信我需要去掉%
中的單引號。 我該怎么做呢?
那里有一個不需要的雙引號。
嘗試
$q['item_desc LIKE \'%?%\'']
或者
$q["item_desc LIKE '%?%'"]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.