wbiehl 0 Denunciar post Postado Janeiro 11, 2011 Olá pessoal este script de busca é show bem completo, mas o problema é que ele não faz pesquisa com acentos e também se o case for diferente. Alguém poderia mostrar como resolver estes problemas? Para assim que pronto poder-mos disponibilizar para o pessoal um sistema de busca completo, pois a dificultade de achar um com estas características é grande. <?php if(! $c ) { ?> <form action="busca.php?c=1" method=POST> <input type="hidden" name="any" id="any" /> <br> <strong>Palavras Chaves:</strong><br /> <label for="all"></label> <input name="all" type="text" size="60" maxlength="50" length=40 /> <br /> <br> <strong>Sessão:</strong><br /> <select name="none" id="none"> <option>TODAS</option> <option value="100004">Leis</option> <option value="100005">Atas</option> <option value="100014">Indicações</option> </select> <br /> <br> <input type="submit" value="Buscar"> </form> <? } else if( $c ) { MySQL_connect ( "localhost" , "usuario" , "senha" ); MySQL_select_db ( "banco" ); if((! $all ) || ( $all == "" )) { $all = "" ; } else { $all = "+(" . $all . ")" ; } if((! $any ) || ( $any == "" )) { $any = "" ; } if((! $none ) || ( $none == "" )) { $none = "" ; } else { $none = "-(" . $none . ")" ; } $query = " SELECT *, MATCH(category_id, title, content) AGAINST ('$all $none $any' IN BOOLEAN MODE) AS score FROM news_publish WHERE MATCH(category_id, title, content) AGAINST ('$all $none $any' IN BOOLEAN MODE)" ; $artm1 = MySQL_query ( $query ); if(! $artm1 ) { echo MySQL_error (). "<br>$query<br>" ; } if( MySQL_num_rows ( $artm1 ) > 0 ) { while( $artm2 = MySQL_fetch_array ( $artm1 )) { $val = round ($artm2[ 'score' ], 3 ); $val = $val * 100 ; //echo "<td> { $artm2 [ 'title' ]} </td>"; echo "<div class=\"busca_titulo\"><a href=\"link.php?news_id={$artm2 [ 'news_id' ]}\"> {$artm2 [ 'title' ]} <a></div> <div class=\"busca_descricao\"> {$artm2 [ 'summary' ]} </div>"; } } else { echo "<div class=\"busca_titulo\"> Nenhum resultado encontrado!<br></div>" ; } echo "<br>" ; } ?> Compartilhar este post Link para o post Compartilhar em outros sites
ell_cpu 0 Denunciar post Postado Janeiro 11, 2011 Usa urlencode. tive um problema esses dias com uma busca de palavras acentuadas no mysql e usei essa funcao pra resolver!! Compartilhar este post Link para o post Compartilhar em outros sites