Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using not equal operator in Cakephp

I have find query that looks like this.

$this->paginate('Article', array('Article.status !=' => 'Inactive', 'Article.user_id !=' => $blocked_ids, 'Article.tags LIKE' => "%" . trim($this->params['url']['tag']) . "%"))

where $blocked_ids is an array of ids. It throws an error

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 '= ('170')

When I removed != it works fine. No Errors

I appreciate any help.

like image 757
Josh Randall Avatar asked Dec 01 '11 11:12

Josh Randall


1 Answers

$this->paginate(
                'Article',
                array (
                     'Article.status <>' => 'Inactive', 
                     'Article.user_id !=' => $blocked_ids, 
                     'Article.tags LIKE' => "%" . trim($this->params['url']['tag']) . "%"
                   )
              );
like image 174
Rumi Avatar answered Sep 18 '22 13:09

Rumi