Getting SQL Error: 1064 in CakePHP
This is the second time recently that I have gotten the exact same error. I think it has to do with the tutorials I am following having deprecated methods.
Today the error comes from my types_controller.php, line 64:
$types = $this->Type->findAll("status=1");
Gives me Error:
Warning (512): SQL Error: 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 'findAll' at line 1
I remember following a tutorial yesterday where a line like $this->Model->search(param) was giving me the error:
SQL Error: 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
Not really sure that the issue is here.
You are correct, that method is deprecated. Replace
findAll("status=1")
with
find('all', array('conditions'=>"status=1"))
See the manual: http://book.cakephp.org/view/1017/Retrieving-Your-Data
精彩评论