Salve a tutti, starei cercando di creare una pagina di search per restituire come risultato le immagini ricercate.....
ecco il form.....
<form method="post" action="Scripts/Search.php">
<input name="Search" type="text" />
<input type="submit" value="Search!">
</form>
ecco....prendo i dati post da search.php
che č fatto cosė
Codice PHP:
require "MySql.php";
$Search=$_POST['Search'];
echo "[b]Search results...for $Search[/b]
";
$res=mysql_query("SELECT ImgCode,ImgOwner,ImgTitle,ImgType,ImgDescription FROM Images WHERE ImgTitle LIKE '%$Search%' OR ImgTags LIKE '%$Search%' OR ImgDescription LIKE '%$Search%'")or die(mysql_error());
while (list($ImgCode,$ImgOwner,$ImgTitle,$ImgType,$ImgDescription)=mysql_fetch_row($res)){
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>$ImgDescription</center></td>
</tr>
<tr>
<td>[url='ShowImage.php?ImgCode=$ImgCode']<input type='button' value='Show'>[/url]</td>
<td>By:[b]$ImgOwner[/b]</td>
</tr>
</table><hr>
";
}
?>
Fino a qui funziona
allora adesso il problema č questo... Se qualcuno scrive + parole nel input....io come faccio a dividerle in + variabili da far ricercare nel database per esempio nelle tags di un 'immagine??
Cioč se io ho nel database "bella", "papā" e lui scrive nel campo "Bella papā" non trova niente perchč tratta "Bella papā" come un'unica stringa mentre nel database ci sono 2 campi......
Come fare??
Grazie per qualsiasi aiuto