Código PHP:
<?php
$link = mysql_connect("localhost", "hola", "VVVVV") or die ("Error en la Base de iyc");
$bd=mysql_select_db("basededatos",$link) or die ("Verifique la Base de iyc");
$Fecha_vab=$_POST["Fecha"];
$Fecha2_vab=$_POST["Fecha2"];
if ($Fecha_vab!="")
{
$sql=mysql_query("SELECT * from `iyc` WHERE Fecha LIKE '%$Fecha_vab%' OR Fecha2 LIKE '%$Fecha2_vab%'",$link);
if (mysql_num_rows($sql)>0)
{
$tabla=mysql_query("SELECT * from `iyc` WHERE Fecha LIKE '%$Fecha_vab%' OR Fecha2 LIKE '%$Fecha2_vab%'",$link);
while ($registro = mysql_fetch_array($tabla))
{
echo '<table border="1" width="100%" id="table1" bordercolor="#000000" cellspacing="1" height="83" cellpadding="0" style="border-collapse: collapse">';
echo '<tr>';
echo '<td><p align="justify" style="margin-left: 5px"><b>FECHA<b></td>';
echo '<td><p align="center"><b>PLANILLA<b></p></td>';
echo '<td><p align="justify" style="margin-left: 5px"><b>DECLARACIÓN<b></td>';
echo '<td><p align="justify" style="margin-left: 5px"><b>PERIODO<b></td>';
echo '<td><p align="justify" style="margin-left: 5px"><b>TOTAL<b></td>';
echo '<td><p align="justify" style="margin-left: 5px"><b>ESTADO<b></td>';
echo '</tr>';
$tabla=mysql_query("SELECT * from `iyc` WHERE Fecha LIKE '%$Fecha_vab%' OR Fecha2 LIKE '%$Fecha2_vab%'",$link);
while ($registro = mysql_fetch_array($tabla))
{
echo '<tr>';
echo '<td width="5" height="30">' . $registro['Fecha'] . '</td>';
echo '<td><p align="center">' . $registro['Inicial'] . '' . $registro['Id'] . '</p></td>';
echo '<td><p align="justify" style="margin-left: 5px">' . $registro['Declara1'] . ' </td>';
echo '<td><p align="justify" style="margin-left: 5px">' . $registro['T1'] . ' <font color="#0000FF">' . $registro['T2'] . '</font> ' . $registro['T3'] . ' <font color="#0000FF">' . $registro['T4'] . '</font> ' . $registro['Anios2'] . '</td>';
echo '<td><p align="justify" style="margin-left: 5px">' . $registro['total'] . ' Bs.</td>';
echo '<td><p align="justify" style="margin-left: 5px">' . $registro['Estado'] . ' </td>';
echo '</tr>';
}
echo '</table>';
}
}
else
{
echo "¡No existen resultados para tu búsqueda!\n";
}
}
else
{
echo "<b>Error:</b> ¡Debes ingresar los iyc correctamente!\n";
}
?>