I'm trying to create a search box with classes, i always use a specific code for this, whithout using classes.
But now, im learning how to use classes, and i need to transfer my old code, to a single class, i tried this function:
function verGaleria() {
$sql = "SELECT * FROM `cds`";
if(($rs=$this->bd->executarSQL($sql))){
if(isset($_GET['buscar'])){
$sql = mysql_query("SELECT * FROM `cds` where name like '%".$_GET['buscar']."%'");
}
while ($row = mysql_fetch_array($rs)) {
$imagem = $row['imagem'];
$ID = $row['ID'];
$artista = $row['artista'];
$preco = $row['preco'];
$titulo = $row['titulo'];
echo '
<style>
.teste{
text-align:center; display: inline-block; width:300px; margin: 0 0 40px 30px; float:left; color:white;
}
</style>
<div class="teste">
<h1>'.$titulo.'</h1>
<h2><img class="cd" src="CDs/'.$imagem.'" width="102" height="126" alt="'.$artista.'"/></h2>
<h3>'.$preco.'€</h3>
</div>
';
}
} else {
return false;
}
}
My from code:
<form method="GET" name="buscar" >
<label><a class="utilizador">Procurar</a>
<br />
<input type="text" name="buscar" id="prc" placeholder="Ex: Rock"/></label>
<input type="submit" class="submitprc" value="Pesquisar" />
</form>