Filtering the current artcile id

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
kkonline
Forum Contributor
Posts: 251
Joined: Thu Aug 16, 2007 12:54 am

Filtering the current artcile id

Post by kkonline »

Code: Select all

SELECT DISTINCT id FROM wow WHERE 0 OR CONCAT(title,content,views,'') LIKE '%".$pieces[$i]."%' ORDER BY id DESC
The query above works fine, but sometimes if the pieces matches with the current article, it returns the id of the article i am viewing.

How to filter the current id of the article from search results?

current id is accessed by $page;
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Use ID field and variable $page in your where clause
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply