我尝试进行搜索,但最终出现错误:
在我的控制器中,我写道:
public function search() {
$this->set('results',$this->History->search($this->data['History']['searchtext']));
}
在我看来,我写道:
//#查看/历史/searchall.ctp
<?php
echo $this->Form->create("History",array('action' => 'search'));
echo $this->Form->input("searchtext", array('label' => 'Search for'));
echo $this->Form->end("Search");
?>
它返回
"Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'search' at line 1" in my search.ctp
在我的历史模型中,我写道:
<?php
class History extends AppModel{
var $name='History';
var $actsAs=array('Searchable');
}
?>