Am I wrong?

is there any problem? I can’t declare this, may be I m wrong

$t = User::model()->lastName;

What do you want to do?

Actually I want to check user_id and bookName from Books table, if user_id and bookName are match then will display the data

$tw2 = Yii::app()->user->id;

$t = Book::model()->bookName;

$test = Yii::app()->db->createCommand("SELECT * FROM Inventory WHERE bookName= $t AND User_id= $tw2")->queryScalar();

if ($test) {



} else {




I think you should read

I find the solution. THanks

@nemo: please share the solution. Maybe it is obvious but it could help someone having same problem, reading this post and not find how to solve the problem :)