cakephp问题

LA_Lai 2013-06-19 06:36:43
这个是我写的代码:
<?php 
class BooksController extends AppController
{
var $name='Books';
var $help='form';
function index() {
$this->Book->recursive = 1;
$books = $this->Book->find('all',array('field'=>array('Book.isbn','Book.title','Author.name')));
$this->set('books', $books);
}
function add()
{
if(!empty($this->data))
{
$this->Book->create();
$this->Book->save($this->data);
$this->redirect(array('action'=>'index'));
}
$authors = $this->Book->Author->generateList();
$this->set('$authors',$authors);
}
}
?>

然后出现这个问题

该怎样解决呢?
...全文
190 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
飞凡的陀螺 2013-07-10
  • 打赏
  • 举报
回复
估计是这句$authors = $this->Book->Author->generateList(); 有问题试试$authors = $this->Book->generateList();
LA_Lai 2013-06-19
  • 打赏
  • 举报
回复
? 那该怎样改?
xuzuning 2013-06-19
  • 打赏
  • 举报
回复
SQLSTATE[42000]: Styntax 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 'generateList' at 这是什么破烂?连一个 SQL 指令都生成不好?

4,251

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧