$search = $_GET['search'];
$newsquery = $connector->query("SELECT id, title, UNIX_TIMESTAMP(dateadded) AS dateadded, article FROM news WHERE article LIKE '%$search%'") or die ("Error in Query: $query.".mysql_error());;
$jobsquery = $connector->query("SELECT id, company, jobtitle, jobdesc, contact, UNIX_TIMESTAMP(dateadded) AS dateadded, UNIX_TIMESTAMP(closingdate) AS closingdate, oxford FROM jobs WHERE jobdesc LIKE '%$search%' ORDER BY dateadded DESC") or die ("Error in Query: $query.".mysql_error());;
$articlequery = $connector->query("SELECT id, title, subtitle, article, author, UNIX_TIMESTAMP(dateadded) AS dateadded FROM inprint WHERE article LIKE '%$search%' ORDER BY dateadded DESC") or die ("Error in Query: $query.".mysql_error());;}
$i=0;
while($row = mysql_fetch_array($newsquery))
{
$all_news[$i] = array( 'title' => $row['title'], 'dateadded' =>$row['dateadded'], 'article' =>$row['article']);
}
$i=1;
while($row = mysql_fetch_array($jobsquery))
{
$all_jobs[] = array( 'company' => $row['company'], 'jobtitle' =>$row['jobtitle'], 'jobdesc' =>$row['jobdesc'], 'contact' =>$row['contact'], 'dateadded' =>$row['dateadded'], 'closingdate' =>$row['closingdate'] );
}
$i=2;
while($row = mysql_fetch_array($articlequery))
{
$all_article[] = array( 'title' => $row['title'], 'subtitle' =>$row['subtitle'], 'article' =>$row['contact'], 'author' =>$row['author'], 'dateadded' =>$row['dateadded'],);
}
if (sizeof($all_news) > 0){
echo 'News Articles Found';}
if (sizeof($all_articles) > 0){
echo 'Jobs Articles Found';}
if (sizeof($all_jobs) > 0){
echo 'InPrint Articles Found';}
OR:
you do a union and glue several different queries together to get one resultset....
but beware of the cols, you have to add static values to the cols, that are not in the table
SELECT whatever, NULL,NULL FROM jobs
UNION
SELECT NULL, whatever,NULL FROM articles
UNION
SELECT NULL,NULL,whatever FROM news
so you get ALL in one table, the cols, that are not available on jobs,new.... are set to NULL