Well, I'm having a question, I'm trying to return from bd only the states that have the term searched for, but I do not want any repeats. follow the code
<?php
$search_term = filter_var($_GET["s"], FILTER_SANITIZE_STRING);
$q = "SELECT DISTINCT estado FROM classificados WHERE texto LIKE '%".$search_term."%' ";
$r = mysql_query($q);
if(mysql_num_rows($r)==0)// se nao encontrar resultado
{
echo "--";
}
else //se encontrar algum resultado
{ echo " <option value='index.php?s=$search_term&e=$estado'> $estado </option>" ;} ?>
</select>