0

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

1 Answers1

0

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 : Does CodeIgniter automatically prevent SQL injection?

cheers

Community
  • 1
  • 1
tarrasch
  • 2,630
  • 8
  • 37
  • 61