In CakePHP 1.2 the syntax changed, so it should be
$this ->find('count', array('conditions'=>array('User.username'=> ....See this: http://book.cakephp.org/view/809/find-count Can't help more unless you show us some SQL :) On Aug 20, 7:07 pm, winegoddess <[email protected]> wrote: > Hello, > > I am having problems with the tutorial, Part 1, Section > 5.http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/s... > > I get this warning: > 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 'findCount' at line 1 [CORE\cake\libs\model > \datasources\dbo_source.php, line 549] > > Looking at my model - user.php - i have this, copied directly from the > tutorial: > > function beforeValidate() { > if (!$this->id) { > if ($this->findCount(array('User.username' => > $this->data > ['User']['username'])) > 0) > { > $this->invalidate('username_unique'); > return false; > } > } > return true; > } > > ******************************************************************************************* > 1. Is there a way to see generated SQL in a log somewhere? > > 2. Any idea why this is happening? Other queries are working, such as > the findAll to get list of users. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
