Duda buscador Hola a todos!!
Estoy modificando un buscador de un script... Tenemos esto al principio de la pagina... luego viene el head etc... Código PHP: <?
include("include/session.php");
$url=explode("/",$_SERVER['REQUEST_URI']);
$tag=substr($url['2'],0,strlen($url['2'])-5);
$tag=str_replace("_"," ",$tag);
$tag=str_replace("-"," ",$tag);
$tag_explodat=explode(" ",$tag); ?> Ahora el buscador...
Funcionasi buscas sólo el artista o sólo la canción por ejemplo si busco "alejandro sanz" si funciona bien. El problema viene cuando busco "alejandro sanz lookig for paradise" ahi ya no me da ningún resultado... no se que puedo hacer...
Gracias ;) Código PHP: <?php
include('include/connection.php');
//REZULTATE COMPLETE
$x=$tag_explodat[0];
$q="SELECT * FROM melodie WHERE activat='1' and melodie LIKE '%" . $tag_explodat[0] . "%' or artist LIKE '%" . $tag_explodat[0] . "%" ;
$m=count($tag_explodat);
for ($i=1; $i<$m; $i++)
{
$q=$q . $tag_explodat[$i] . "%";
}
$q=$q . "'";
$res=mysql_query($q) or die (mysql_error());
if(mysql_num_rows($res)>0)
{
echo '
<tr class="last_text_tbl">
<td width="35" align="center">Nr.</td>
<td width="440" align="left"><strong> ' . $tag . ' </strong></td>
<td width="45" align="center">Hits</td>
</tr>';
} else
{
echo ' <tr>
<td height="35" align="center" background="' . $site . ' img/bg-menu-dr-sg.gif" class="menu_dreapta">Lo sentimos, no se ha encontrado ningún resultado para: "' . $tag . '".</td>
</tr>';
}
$i=1;
while ($row=mysql_fetch_array($res))
{
$melodieurl=str_replace(" ","-",$row['melodie']);
$melodieurl=str_replace("'","-",$melodieurl);
$melodieurl=str_replace("`","-",$melodieurl);
$melodieurl=str_replace("[","",$melodieurl);
$melodieurl=str_replace("]","",$melodieurl);
$melodieurl=str_replace("(","",$melodieurl);
$melodieurl=str_replace(")","",$melodieurl);
$melodieurl=str_replace(",","-",$melodieurl);
$melodieurl=str_replace(".","-",$melodieurl);
$melodieurl=str_replace(":","-",$melodieurl);
$melodieurl=str_replace(";","-",$melodieurl);
$melodieurl=str_replace("?","",$melodieurl);
$melodieurl=str_replace("!","-",$melodieurl);
$melodieurl=str_replace("&","",$melodieurl);
$melodieurl=str_replace("@","",$melodieurl);
$melodieurl=str_replace("*","",$melodieurl);
$melodieurl=str_replace("^","",$melodieurl);
$melodieurl=str_replace("%","",$melodieurl);
$melodieurl=str_replace("#","",$melodieurl);
$melodieurl=str_replace("=","",$melodieurl);
$melodieurl=str_replace("+","-",$melodieurl);
$melodieurl=str_replace("<","",$melodieurl);
$melodieurl=str_replace(">","",$melodieurl);
$melodieurl=str_replace("|","",$melodieurl);
$melodieurl=str_replace("{","",$melodieurl);
$melodieurl=str_replace("}","",$melodieurl);
$melodieurl=str_replace("\"","",$melodieurl);
$melodieurl=str_replace("/","",$melodieurl);
$melodieurl=str_replace("~","-",$melodieurl);
$melodieurl=str_replace("é","e",$melodieurl);
$melodieurl=str_replace("á","a",$melodieurl);
$melodieurl=str_replace("ó","o",$melodieurl);
$melodieurl=str_replace("Ã*","i",$melodieurl);
$melodieurl=str_replace("ú","u",$melodieurl);
$melodieurl=str_replace("ñ","n",$melodieurl);
$melodieurl=str_replace("é","e",$melodieurl);
$melodieurl=str_replace("á","a",$melodieurl);
$melodieurl=str_replace("ó","o",$melodieurl);
$melodieurl=str_replace("í","i",$melodieurl);
$melodieurl=str_replace("ú","u",$melodieurl);
$melodieurl=str_replace("ñ","n",$melodieurl);
$melodieurl=str_replace("Ñ","N",$melodieurl);
$melodieurl=str_replace("ç","c",$melodieurl);
$melodieurl=str_replace("´","-",$melodieurl);
$melodieurl=str_replace("è","e",$melodieurl);
$artisturl=str_replace(" ","-",$row['artist']);
$artisturl=str_replace("'","-",$artisturl);
$artisturl=str_replace("`","-",$artisturl);
$artisturl=str_replace("[","",$artisturl);
$artisturl=str_replace("]","",$artisturl);
$artisturl=str_replace("(","",$artisturl);
$artisturl=str_replace(")","",$artisturl);
$artisturl=str_replace(",","-",$artisturl);
$artisturl=str_replace(".","-",$artisturl);
$artisturl=str_replace(":","-",$artisturl);
$artisturl=str_replace(";","-",$artisturl);
$artisturl=str_replace("?","",$artisturl);
$artisturl=str_replace("!","-",$artisturl);
$artisturl=str_replace("&","",$artisturl);
$artisturl=str_replace("@","",$artisturl);
$artisturl=str_replace("*","",$artisturl);
$artisturl=str_replace("^","",$artisturl);
$artisturl=str_replace("%","",$artisturl);
$artisturl=str_replace("#","",$artisturl);
$artisturl=str_replace("=","",$artisturl);
$artisturl=str_replace("+","-",$artisturl);
$artisturl=str_replace("<","",$artisturl);
$artisturl=str_replace(">","",$artisturl);
$artisturl=str_replace("|","",$artisturl);
$artisturl=str_replace("{","",$artisturl);
$artisturl=str_replace("}","",$artisturl);
$artisturl=str_replace("\"","",$artisturl);
$artisturl=str_replace("/","",$artisturl);
$artisturl=str_replace("~","-",$artisturl);
$artisturl=str_replace("é","e",$artisturl);
$artisturl=str_replace("á","a",$artisturl);
$artisturl=str_replace("ó","o",$artisturl);
$artisturl=str_replace("Ã*","i",$artisturl);
$artisturl=str_replace("ú","u",$artisturl);
$artisturl=str_replace("ñ","n",$artisturl);
$artisturl=str_replace("é","e",$artisturl);
$artisturl=str_replace("á","a",$artisturl);
$artisturl=str_replace("ó","o",$artisturl);
$artisturl=str_replace("í","i",$artisturl);
$artisturl=str_replace("ú","u",$artisturl);
$artisturl=str_replace("ñ","n",$artisturl);
$artisturl=str_replace("Ñ","N",$artisturl);
$artisturl=str_replace("ç","c",$artisturl);
$artisturl=str_replace("´","-",$artisturl);
$artisturl=str_replace("è","e",$artisturl);
$data=explode(" ",$row['data_ad']);
$data=explode("-",$data['0']);
echo "<tr class='last_link'>
<td height='20' width='35' align='center'>" . $i . "</td>
<td height='20' width='440' align='left'>
<a href='$site/" . $artisturl . "---" . $melodieurl . "_" . $row['id'] . ".html' title='" . $row['melodie'] . "' >" . $row['artist'] . " - " . $row['melodie'] . "</a></td>
<td height='20' width='45' align='center'>" . $row['hits'] . "</td>
</tr>
";
$i++;
}
?> |