I have a query here but i would also like to make it so that it will take any of the reply for LIKE'%$search%' but i cant get it without failing i know its to do with the grouping "GROUP BY post.`id`" but i cant work out how to sort it out.
HTML:
$sql = "SELECT
post.`id`,
post.`post-id`,
post.`username`,
post.`date`,
post.`subject`,
post.`post`,
post.`lastpost`,
post.`views`,
post.`lastposttime`,
reply.`reply-id`,
reply.`username` AS `reply_username`,
reply.`date` AS `reply_date`,
reply.`subject` AS `reply_subject`,
reply.`post` AS `reply_post`,
COUNT(DISTINCT reply.`id`) AS `replycount`,
topic.`id` AS `topic_id`,
topic.`title` AS `topic_title`,
topic.`category_id` AS `topic_cat_id`
FROM
`forum-posts`
AS
`post`
LEFT JOIN `forum-reply`
AS
`reply`
ON
post.`id` = reply.`reply-id`
LEFT JOIN `forum-topics`
AS
`topic`
ON
post.`post-id` = topic.`id`
WHERE
post.`post` LIKE'%$search%'
OR
post.`username` LIKE'%$search%'
OR
post.`date` LIKE'%$search%'
OR
post.`subject` LIKE'%$search%'
GROUP BY post.`id`
";