views:

34

answers:

1

Hello,

i'm using CodeIgniter for developing a community board. As I'm using nested sets to get a nested forum hierarchy, I have to run a lot of queries such as:

SELECT `id` FROM `forums` WHERE 1 BETWEEN `lft` AND `rgt`

My problem: CodeIgniter is replacing the "1" by "`1`" because the "1" is recognized as a column name. Of course, the query does not work any more.

Is there a way to get it working?

thx in advance

A: 

is this what you need?

$this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement. you can try if query does that too. also there is this question : http://stackoverflow.com/questions/1615792/does-code-igniter-automatically-prevent-sql-injection

cheers

tarrasch