Select distinct... in fulltext search
- by lam3r4370
<?php session_start();
$user =$_GET['user'];
$conn = mysql_connect("localhost","...","...");
mysql_select_db("...");
$sql= "SELECT filter FROM userfilter WHERE user='$user'";
$mksql = mysql_query($sql); while($row =mysql_fetch_assoc($mksql)) {
$filter=$row['filter'];
$sql2 = "SELECT DISTINCT * FROM rss WHERE MATCH(content,title) AGAINST ('$filter')";
$mksql2 = mysql_query($sql2) or die(mysql_error());
while($rows=mysql_fetch_assoc($mksql2))
{ echo ..... }
?>
If I have two rows content that contains the $filter ,it outputs me that content but it's repeating.
For example:
title|content
asd |This is a sample content ,number one
das
|This is a
sample content ,number two
....
And if my keywords are "sample" and "number" ,it outputs me twice the title and the content.How to prevent that?