I have 2 tables first one tblactive ( ac_id, ac_title, ac_text) , second one tblnews (n_id, n_title, n_text)
Also I have 3 files
Active.php (in this file I obtain data from table active and display it through function displayac, ex. <a href=active.php?op=displayac&ac_id=$ac_id>$ac_title</a>
)
News.php (in this file I obtain data from table news and display it through function displaynews, ex. <a href=news.php?op=displaynews&n_id=$n_id>$n_title</a>
)
The problem
Search.php ( in this file I want to search the (searchword like ac_text and searchword like n_text in the 2 tables active & news at same time and display result of search containing links to their original files ex.
This my query
$result ="(select n_title,n_text, n_id from tblnews where n_text LIKE '%$searchword%')
union
(select ac_title,ac_text, ac_id from tblactive where ac_text LIKE '%$searchword%') limit $page, $perpage";
$query=mysql_query($result);
If the searchword found in ac_text column the link will be <a href=active.php?op=displayac&ac_id=$ac_id>$ac_title</a>
And if searchword found in n_text column the link will be <a href=news.php?op=displaynews&n_id=$n_id>$n_title</a>