CodeIgniter Forums

Full Version: Problems creating an SQL query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello I'm having problems with an SQL query I'm trying to do with CodeIgniter

$comments = $this->db
    ->select(array('posts.content', '', 'posts.userid', 'posts.postid', 'posts.nodeview', 'posts.questionid','posts.groupid'))->join('users', 'posts.userid =')
    ->select(array('users.username','users.avatarpath'))->order_by('posts.datetimenumber', 'DESC')
    ->limit(20, $page)
    ->get_where('posts', array('posts.userid' => $user['id'],'posts.nodeview !=' => "article",'posts.nodeview !=' => "pm" /*, 'posts.floor >' => 0 */  ) )

The problem is that I am using 2 NOT queries on posts.nodeview, and only one of them is being applied.

How can I make the query work?
I can only see one of them: 'posts.nodeview !='

Are you meaning this?
'posts.nodeview ='
PHP Code:
from('posts p')
join('users u''p.userid =')
where_not_in('p.nodeview', array('article','pm'))
$query $this->db->get();
if (
$query->num_rows() > 0) {
else {
  return FALSE;

This will select the records where posts.nodeview is not 'article' and not 'pm'.
Is that what you need?