I have a PHP script that is trying to combine 2 queries using the union operator.
My code is as follows:
Code: Select all
$sql = "
SELECT
DATE_FORMAT(news_date, '%d-%m-%Y') as news_date2, news_id, news_headline, news_summary, news_body, news_image, news_image_detail, news_author, news_tj, news_pdf, news_pdf, news_tj_issue, news_price, news_rating, news_votes, news_tags ,
MATCH(news_headline, news_body) AGAINST('$k') AS score
FROM news
WHERE MATCH(news_headline, news_body) AGAINST('$k')".$query."
UNION
SELECT thread_id from hrd where parent_id IS NULL ORDER BY score DESC";
if(isset($offset) && (isset($limit)))
{
$sql .= " Limit $offset, $limit";
}any ideas as to where I am going wrong?
thanks in advance