在CakePHP中获取SQL错误:1064

JD *_*cks -1 php cakephp cakephp-1.3

这是我最近第二次得到完全相同的错误.我认为它与我正在使用的已弃用方法的教程有关.

今天错误来自我的types_controller.php,第64行:

$types = $this->Type->findAll("status=1");
Run Code Online (Sandbox Code Playgroud)

给我错误:

警告(512):SQL错误:1064:您的SQL语法中有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的"findAll"附近使用正确的语法

我记得昨天跟着一个教程,其中像$ this-> Model-> search(param)这样的行给了我错误:

SQL错误:1064:您的SQL语法中有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的"搜索"附近使用正确的语法

不确定问题在这里.

jbr*_*ass 5

你是对的,该方法已被弃用.更换

findAll("status=1") 
Run Code Online (Sandbox Code Playgroud)

find('all', array('conditions'=>"status=1"))
Run Code Online (Sandbox Code Playgroud)

参见手册:http://book.cakephp.org/view/1017/Retrieving-Your