$query="SELECT * FROM advisor
LEFT JOIN work ON (work.id_adv= advisor.id_adv)
LEFT JOIN work_file ON (work.id_work= work_file.id_work)
WHERE (path LIKE '%.$type') AND (name_thai OR name_eng LIKE '%$nwork%')AND (name_adv OR lname_adv LIKE '%$adv%') AND (year BETWEEN '$start_year' AND '2570') and (work.publish= '0') order by year DESC";