Sto realizzando un search in php che vada a ricercare tra le immagini memorizzate in un database mysql...
ho scritto questo codice, ma se per esempio scrivo le parole al contrario non trova niente... come mai? e come posso risolvere?
es: ciao papā (lo trova) [č anche il titolo preciso dell'immaigne]
ma papā ciao (non lo trova) [titolo invertito]
ecco tutto il mio codice
Codice PHP:
<?php
require "MySql.php";
$Ricerca=$_POST['Search'];
echo "[b]Search results...for $Search[/b]
";
//divido
$Search=explode("#",$Ricerca);
//ciclo while
foreach($Search as $parola)
{
//levo gli spazi
$ricerca = trim($parola);
$res=mysql_query("SELECT ImgCode, ImgTitle,ImgDescription, ImgType, ImgOwner FROM Images WHERE ImgTitle LIKE '%$ricerca%'OR ImgTags LIKE '%$ricerca%' OR ImgOwner LIKE '%$ricerca%' OR ImgDescription LIKE '%$ricerca%' ")or die(mysql_error());
if(list($ImgCode, $ImgTitle, $ImgDescription, $ImgType, $ImgOwner)=mysql_fetch_row($res)){
$res2=mysql_query("SELECT AvatarCode, AvatarType FROM Avatars WHERE AvatarOwner='$ImgOwner'")or die(mysql_error());
list($AvatarCode,$AvatarType)=mysql_fetch_row($res2);
echo "<table style='width: 100%; height: 167px'>
<tr>
<td>[b]$ImgTitle[/b]</td>
</tr>
<tr>
<td class='style1' style='width: 390px'>[url='ShowImage.php?ImgCode=$ImgCode'][img]../public/Img$ImgOwner/$ImgCode$ImgType[/img][/url]</td>
<td><center>[b]Description:[/b]
$ImgDescription</center></td>
</tr>
<tr>
<td>[url='ShowImage.php?ImgCode=$ImgCode']<input type='button' value='Show'>[/url]</td>
<td>By:[b][url='PublicProfile.php?Username=$ImgOwner']$ImgOwner[/url][/b]
[img]../public/Img$ImgOwner/$AvatarCode$AvatarType[/img]</td>
</tr>
</table><hr>
";
}
else
{
echo"No results for your search";
}
//fine while
}
?>
Grazie per qualsiasi illumiazione.
Marmos