Código PHP:
<form method="POST" action="musicales.php">
<table border="0" width="100%">
<tr bgcolor="#006699">
<td colspan="2"><div align="center" class="Estilo3">Buscar DVD Musical </div></td>
</tr>
<tr>
<td width="31%">
<p align="right">Buscar: </td>
<td width="69%"><input type="text" name="buscar" size="32">
<input type="submit" value="Enviar" name="envio"></td>
</tr>
</table>
</form>
<?
}
elseif
($buscar != '')
{
// Listamos los contactos
// Armo la consulta
$sql = "select desc_musical, grupo, anio FROM musicales
where desc_musical LIKE '%buscar' or grupo LIKE '%buscar' or anio LIKE '%buscar'";
// Ordeno
$result = mysql_query($sql, $coneccion);
if (mysql_error())
{
echo "ERROR al buscar el titulo requerido - ". mysql_errno().":". mysql_error()."<br>";
}
// Calculo la cantidad de resultados
$cant_resultados = mysql_num_rows($result);
if ($cant_resultados >= 1)
{
// Muestro los resultados
echo "Se han encontrado $cant_resultados resultados<br>";
?>
<table width="100%" border="0" align="center">
<tr align="center" valign="middle" bgcolor="#006699">
<th width="259" scope="col"><span class="Estilo7">GRUPO</span></th>
<th width="291" scope="col"><span class="Estilo7">TITULO</span></th>
<th width="86" scope="col"><span class="Estilo7">AÑO</span></th>
</tr>
</table>
<?
while($myrow = mysql_fetch_array($result))
{
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td width="262" height="18" nowrap scope="col"><div align="left" class="Estilo2 Estilo8"> <? echo "$myrow[grupo]"; ?></div></td>
<th nowrap scope="col"><span class="Estilo10"><? echo $myrow[desc_musical]; ?></span></th>
<td width="92" nowrap scope="col"><div align="left" class="Estilo10"></div>
<div align="center" class="Estilo10"><? echo $myrow[anio]; ?></div></td>
</tr>
</table>
<?
} // end while
}
else
{
echo "No se han encontrado resultados coincidentes<br>";
}
}
?>