Oct
10
CakePHP - the right syntax to use near ‘generateList’
October 10, 2008 |
If you have been using the cakePHP 1.2 beta’s scarfold to bake (generate) your controller, when you go to the add article page, there will be an error message like the one below:
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 ‘generateList’ at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 512]
If this happens to you, then that means your cake baked the wrong version of CRUD code for you, to fix the problem, you first locate the controller file, my controller’s name is posts, so my controller file is located at: cake/app/controllers/posts_controller.php.
Looking for the code:
generateList();
It may appear more than once in your code, replace it with:
find('list');
Since CakePHP 1.2, the CakePHP 1.1 syntax generateList(); has been replaced by the powerful find(”).
Hope this helps! :)
Similar Posts
- CakePHP Solution for Warning: Cannot modify header information - headers already sent
- CakePHP Solution for Could not open input file: acl.php
- Cook up Web sites fast with CakePHP ACL Problem
- Cook up Web sites fast with CakePHP knownusers.thtml
- Cook up Web sites fast with CakePHP MySQL Syntax Problem
- CakePHP acl delete aro Correct Systax
- Cook up Web sites fast with CakePHP - Invalid Login
Comments
3 Comments so far



















Incredible!
I didn’t think that there was a solution I could find.
How are you with zend eclipse?
I can debug php scripts ok, but it chokes when I try to debug a controller with:
class ‘controller’ not found
If you don’t know the answer, I would sure appreciate a lead.
Thanks again,
Bill Goss
Hi, Bill
I am glad this post helps :)
I am not so familiar with eclipse.
cakephp has very bad error report, i also always receive: class ‘controller’ not found. The error message doesn’t make much sense, normally I will just have to dig into the cake or check the log for answer, hope this helps :)
Thanks.
Its really helpful