Select distinct... in fulltext search
Posted
by
lam3r4370
on Stack Overflow
See other posts from Stack Overflow
or by lam3r4370
Published on 2010-12-25T16:19:12Z
Indexed on
2010/12/25
16:54 UTC
Read the original article
Hit count: 238
mysql
|full-text-search
<?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?
© Stack Overflow or respective owner