cms

Hello friends, I have a problem… In my project I want to use two I’d,one is current user I’d which is

      yii:app()->user->id

And other I’d is any other user in my database… Can anybody give any idea to how to use other id…????

Resultant sql query should be

"select user_I’d, guest_id from table xx where user_I’d=Yii :app()->user->id and

   guest_id =any other user???"

You may get any random record from user table and use the id of that row for random record may follow

$max = Table::model()->count();

$offset = rand(0,$max);

$model = Table::model()->find(array(‘offset’=>$offset));

provided at

http://www.yiiframework.com/forum/index.php/topic/15298-how-can-i-get-random-values-from-model/

and may add check for valid user returned from model request if not tan recall the user table until you get desired.