我有一个错误:
错误号: 1064 您的SQL语法出现了错误;请检查与您的MariaDB服务器版本相对应的手册,以便在第3行使用接近'%Chisel :120x3/440%‘的接近条件的语法。
SELECT * FROM `inv_tool` WHERE (insert_date LIKE '%Chisel Round size: 120x3/440%'
|| item_group LIKE '%Chisel Round size: 120x3/440%' ||
item_name LIKE '%Chisel Round size: 120x3/440%' ||
serial_number LIKE '%Chisel Round size: 120x3/440%' ||
condition LIKE '%Chisel Round size: 120x3/440%')文件名: D:/LocalWebServer/htdocs/ptes_is/application/models/Model_invsys.php 线路号码: 73
如果我使用这三个以上的列来查找:
public function find_in_tool ($find) {
$this -> db -> where ("(insert_date LIKE '%$find%' ||
item_group LIKE '%$find%' || item_name LIKE '%$find%' ||
serial_number LIKE '%$find%' || condition LIKE '%$find%')");
$query = $this -> db -> get ('inv_tool') ;
return $query -> result () ;
}但是如果我只使用3,就没有问题了。
public function find_in_tool ($find) {
$this -> db -> where ("(insert_date LIKE '%$find%' ||
item_group LIKE '%$find%' || item_name
LIKE '%$find%')");
$query = $this -> db -> get ('inv_tool') ;
return $query -> result () ;
}但我真的需要更多的.
发布于 2016-09-15 06:02:48
与列数无关,与MySQL/MariaDB保留关键字(条件)有关:https://dev.mysql.com/doc/refman/5.5/en/keywords.html
将您的列名和表名包装在后面以避免冲突:
`condition` LIKE ...https://stackoverflow.com/questions/39503910
复制相似问题