Compare Multiple Values In Model Search

Hello everybody and thanks for reading.

In my model i have a search function set up in the following way


public function search()

	{

		// Warning: Please modify the following code to remove attributes that

		// should not be searched.


		$criteria=new CDbCriteria;

                $criteria->order = "creation_date DESC";

                $criteria->compare('meeting_type',4);

               

                $criteria->compare('meeting_type',$this->meeting_type);

                


		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

		));

	}

What the above code dose is filters all the meetings that are assigned a meeting_type of 4.

My question is how can i filter or search for multiple values , how can i search for more than one value for eg 4 and 5 and 6 eg $criteria->compare(‘meeting_type’,4, 5, 6);<-wrong->

$criteria->compare(‘meeting_type’,4)

$criteria->compare(‘meeting_type’,5)

$criteria->compare(‘meeting_type’,6)

Help will be most appreciated

Dear Friend

That should be like the following to acheive the desired functionality.




$criteria->compare('meeting_type',array(4,5,6));



Regards.

Friend you are awsome ! This is the second time you help me out ! Thanks a lot , if you need help know that you can always ask me.

By the way your solution is correct !

$criteria->compare(‘CONCAT_WS(" ",columnFName,columnMName,columnLName)’,$this->Name,true);

you can filter on 3 column values in single filter textbox name