Hello friends I am trying to fetch data in laravel but I am getting the error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.id' in 'where clause' (SQL: select publications
.*, education
.research_area
from education
inner join publications
on education
.user_id
= publications
.user_id
where users
.id
= 5). Please help.
My controller is given.
public function publicationpdf()
{
$user_id = Auth::user()->id;
$data['data'] = DB::table('education') ->join('publications', 'education.user_id', '=', 'publications.user_id')->select('publications.*','education.research_area') ->where('users.id',$user_id)
->get();
if(count ($data)>0){
return view('pdf/publicationpdf',$data);
}
else
{
return view('pdf/publicationpdf');
}
}
I am not getting the desired result. while using 'publication.user_id',$user_id, I am getting the following result.
While I have only two rows of the current login user in publications table given picture.