$query = mysql_query("select bgwords.bg_word from bgwords inner join trwords on trwords.id=bgwords.id where trwords.tr_word like '$search'")

satırının sonunda ; yok