public function searchItem($itemname) //search item based on itemname
{
$itemname = (string)$itemname;
$select = $this->select()
->from(array('item'))
->where('itemname LIKE "%"?"%', $itemname);
$row = $this->fetchAll($select);
if (!$row) { //if row can't be found
throw new Exception("Could not find row $itemname"); //Catch exception where itemid is not found
}
return $row->toArray();
}
关于如何使用两个'%'的任何想法?我尝试使用'和'的组合,但它不起作用,无法弄清楚要使用什么。提前感谢。