this is my function inside my MODEL : Post

my condition seems to be fine except that the results return are not
UNIQUE,
and i don't know why this can happen.

any idea or suggestion would be appreicate.

Tom

// Search (April 29th, 2007)
        function search( $looking_for_text, $category_id )
    {
                if($category_id == 'all')
                {
                        $constraint = array(    'OR' => array(  'Post.topic'    
=>      "LIKE %
$looking_for_text%",
                                                                                
                        'Post.content'  =>      "LIKE %$looking_for_text%")
                                                                );

                        $ret = $this->findAll($constraint);
                        return $ret;
                }
                else
                {
                        $constraint = array(    'AND'   => array(       
'Post.category_id' => 3),

                                                                        'OR'    
=> array(       'Post.topic'    =>"LIKE %$looking_for_text%",
                                                                                
                                'Post.content'  =>"LIKE %$looking_for_text%"
                                                                                
                        )


                                                                );

                        $ret = $this->findAll($constraint);
                        return $ret;
                }
    }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to