i am using this code to search 2 tables where $id is a variable
$id=$_REQUEST[‘company_id’];
$result=User::model()->findBysql(‘select a.email from user a , recruiter b where a.id=b.user_id and b.company_id=$id’);
i am getting error this code is not working any ideas please
I got help from yii live chat they told me because id is variable the sql query should be in double quotes and id in {}
$result = User::model()->findBysql(“select a.email from user a , recruiter b where a.id=b.user_id and b.company_id={$id}”);
Thanks for the answers