I would like to know if any one has any working code that could show related blog post say about four or five based on the category of the current blog post. Note that am NOT USING wordpress or any other blogging script amd using a simple blog script i wrote in php.
My database is quite simple : : I have a table that houses all the post and a category column. so all post in the DB have a set category. I would like the script to select and return any for latest based on date submitted.
This is my current query
select * from post where category = '$current_blog_post_category' order by post_date desc limit 4
the problem with this howeve is that once the query runs it still returns the current post as a result. i would like the current post to be ignored in the query. Any work around will be appreciated.
Thanks
Try something like this:
select * from post
where category = '$current_blog_post_category'
AND post.id <> '$current_blog_post_id'
order by post_date desc limit 4
Please note that i suppose that 'id' is named your column that store post ids.