1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help me this problem

Discussion in 'PHP' started by suraj51985, Oct 27, 2010.

  1. #1
    sqlk=mysql_query("select DISTINCT id,title from f_topics where title LIKE '%$value%' AND description LIKE '%$value%' GROUP BY id ");

    this is my sql query



    where $value contain keyword that are automatically extracted from discussions done by user
    My problem is ---supp i get three keywords like data,mining,water from one description
    in this case my query first check for word data in all the description...if it found it display..then it check for word mining if it found in same description it display again the same title.....vice versa....so please help me in avoiding duplicate entry.i already use array_unique,DISTINCT,GROUP BY.............


    this is my query that extract keyword from database


    $sql=mysql_query("select id,title,description from topics where pid='$login'");
    while($row=mysql_fetch_array($sql))
    {
    $data=$row['description'];
    $extract=word($data); //this is a function call
    $data1=implode(',',array_keys($extract));
    $break=explode(",",$data1);
    foreach($break as $value) //this statement gives keyword
    {
    $sqlk=mysql_query("select DISTINCT id,title from f_topics where title LIKE '%$value%' AND description LIKE '%$value%' GROUP BY id ");
    while($row1=mysql_fetch_array($sqlk))
    {
    echo $row1['title'];
    echo '<pre>', print_r($row1, true), '</pre>';

    }
     
    suraj51985, Oct 27, 2010 IP