Yii Framework Forum: Automatic generate compare - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Automatic generate compare Rate Topic: -----

#1 User is offline   Speeedfire 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 182
  • Joined: 02-March 12

Posted 08 April 2012 - 04:01 PM

How to generate automatice compare?
I have one field some time is it array(2-3-4... variable).
example:
example=> "one"
or
example=> "one", "two"

The example query is:
example like %one% or %two%
or
example like %one%


My code is:
this->_criteria->compare($example, $value, true);

But is generate this query's.

1. example 
example=:ycp2
:ycp2 => one

2.example
example IN (:ycp2, :ycp3)
:ycp2 => one
:ycp3 => two



Solved: :)
foreach($value as $val) {
  $this->_criteria->addSearchCondition($hirdetes, $val);
}

This post has been edited by Speeedfire: 08 April 2012 - 04:06 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users