I have found the most common mistake I make when I get SQL syntax
errors like this, is that I have not properly escaped my "conditions"
statement in my find.

Something like so works.

$conditions = "Kjv.bnum=$bnum AND Kjv.cnum=$cnum";
        $verses = $this->find('list',
                              array('fields'=>'Kjv.vnum',
                              'conditions'=>array($conditions),
                              'recursive'=>-1
                              ));


> 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 'FROM `roles` AS `Role`   WHERE 1 = 1' at
> line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 535]
>
> Code | Context
>
> $sql    =       "SELECT  FROM `roles` AS `Role`   WHERE 1 = 1   "
> $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 'FROM `roles` AS `Role`   WHERE 1 = 1' at line 1"

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to