On Sat, Mar 14, 2009 at 8:53 AM, kaushik <kaushikwo...@gmail.com> wrote:
>
> How to use not equal to in condition in finall()?
>
>        $data = $this->Blog->findAll(array('Blog.isActive' =>
> 'Y','Blog.blogImage' => ''),array
> ('Blog.blogId','Blog.blogImage','Blog.blogTitle'));
>
> I want to change it so that it finds out blogImage!=''. How to do that?

This should do it:
$data = $this->Blog->find(
        'all',
        array(
                'conditions' => array(
                        'Blog.isActive' => 'Y',
                        'Blog.blogImage !=' => ''),
                ),
                'fields' => array(
                        'Blog.blogId','Blog.blogImage','Blog.blogTitle'
                )
        )
);

I suggest you use NULL rather than an empty string, though. Also, use
(TINY)INT or BOOLEAN instead of 'Y' & 'N' for boolean columns.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to