Welcome Guest, Not a member yet? Register   Sign In
Active Record bug?
#1

[eluser]Unknown[/eluser]
hello!

the code:
Code:
$query = $db->select('CONCAT( REPEAT( "---", ( COUNT(*)-1 )), c1.name )')
            ->from($this->_tableName . ' c1')
            ->join($this->_tableName . ' c2', 'c1.lft BETWEEN c2.lft AND c2.rgt', 'INNER')
            ->group_by('c1.name')
            ->order_by('c1.lft', 'ASC');

the error message:

A Database Error Occurred

Error Number: 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 '`BETWEEN` c2.lft AND c2.rgt GROUP BY `c1`.`name` ORDER BY `c1`.`lft` ASC' at line 3

SELECT CONCAT( REPEAT( "---", ( COUNT(*)-1 )), `c1`.`name` ) FROM (`categories` c1) INNER JOIN `categories` c2 ON `c1`.`lft` `BETWEEN` c2.lft AND c2.rgt GROUP BY `c1`.`name` ORDER BY `c1`.`lft` ASC

any ideas to solve this problem. Between gets quoted, and i don't know why.

thx for your help.




Theme © iAndrew 2016 - Forum software by © MyBB