tags:

views:

25

answers:

1

Is there a way I can search a posts tags for related posts but exclude the posts that is being searched from the display results? If so how? And where would I place the code at in the query?

Here is what I got so far.

SELECT *
FROM users_posts
WHERE users_posts.title LIKE '%$search_tag%' OR users_posts.summary LIKE '%$search_tag%' OR users_posts.content LIKE '%$search_tag%'
ORDER BY RAND() 
LIMIT 5
A: 

Just eliminate the current post by adding something like this to your WHERE clause:

and users_posts.id <> @CurrentPostID
RedFilter
Can I use this to `and users_posts.id != @CurrentPostID` are they the same?
needIT
Yes, they are both the `not equal operator`.
RedFilter