Asi lleno mi tabla:
Código PHP:
<form name="lista" id="lista" action="anuncio_detalle.php" method="post"><table width="580" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="2" rowspan="3" bgcolor="#00892F"></td>
<td height="2" bgcolor="#00892F"></td>
<td width="2" rowspan="3" bgcolor="#00892F"></td>
</tr>
<tr>
<td>
<table width="576" border="0" cellpadding="0" cellspacing="0">
<?php
//PREGUNTAMOS SI EXISTEN REGISTROS
if($num>0){
?>
<tr>
<td align="center" bgcolor="#61A54A"><table width="65" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Anuncio</td>
<td><div id="anuncioup" class="btnLista">
<button name="btn_up" type="submit" id="bnuevo" class="btnLista">
<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/iconos/arrow_up.gif" width="9" height="8" /></td>
</tr>
</table>
</button>
</div></td>
</tr>
</table></td>
<td width="1" bgcolor="#00892F"></td>
<td align="center" bgcolor="#61A54A"><table width="60" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Rubro</td>
<td><div id="anuncioup" class="btnLista">
<button name="btn_up" type="submit" id="bnuevo" class="btnLista">
<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/iconos/arrow_up.gif" width="9" height="8" /></td>
</tr>
</table>
</button>
</div></td>
</tr>
</table></td>
<td width="1" bgcolor="#00892F"></td>
<td align="center" bgcolor="#61A54A"><table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Fecha Registro </td>
<td><div id="anuncioup" class="btnLista">
<button name="btn_up" type="submit" id="bnuevo" class="btnLista">
<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/iconos/arrow_up.gif" width="9" height="8" /></td>
</tr>
</table>
</button>
</div></td>
</tr>
</table></td>
<td width="1" bgcolor="#00892F"></td>
<td align="center" bgcolor="#61A54A">Logo</td>
<td width="1" bgcolor="#00892F"></td>
<td width="70" align="center" bgcolor="#61A54A">Ver</td>
</tr>
<?php
//BUSQUEDA DE LOS REGISTROS DE LA EMPRESA DEL CLIENTE
for ($i=0; $i<$num; $i++) {
$idempresa=mysql_result($rs,$i,"empresa_id");
$nombre=mysql_result($rs,$i,"empresa_nombre");
$categoria=mysql_result($rs,$i,"categoria_nombre");
$fecha=mysql_result($rs,$i,"empresa_fecha_registro");
$imagen=mysql_result($rs,$i,"empresa_img_nombre");
//CON ESTO CAPTURO EL ID DE LOS REGISTROS POR FILA
$_SESSION["idempresa"]=$idempresa;
$codempresa=$_SESSION["idempresa"];
?>
<tr>
<td height="25" align="center"><?php echo $nombre; ?>//AQUI PONGO EL ID PARA VERIFICAR<?php echo $codempresa; ?></td>
<td bgcolor="#00892F"></td>
<td align="center"><?php echo $categoria; ?></td>
<td bgcolor="#00892F"></td>
<td align="center"><?php echo $fecha; ?></td>
<td bgcolor="#00892F"></td>
<td height="40" align="center"><img src="<?php echo "../images/empresa/".$imagen; ?>" width="30" height="30" /></td>
<td bgcolor="#00892F"></td>
<td align="center"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>//Este es el boton detalles que se genera en cada fila
<div id="anuncioup" class="btnVerLista">
<button name="btn_up" type="submit" id="bnuevo" class="btnVerLista">
<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/iconos/mail/info.png" width="16" height="16" /></td>
</tr>
</table>
</button>
</div>
</td>
</tr>
</table></td>
</tr>
<?php
//PREGUNTAMOS SI HAY MAS DE UNO PARA GENERAR LA LINEA
if($num>1){
?>
<tr>
<td height="1" colspan="10" bgcolor="#00892F"></td>
</tr>
<?php
}
?>
<?php
//CERRAMOS EL PRIMER IF Y EL FOR
}
}
else{
echo "No existen registro aun.";
}
?>
</table>
</td>
</tr>
<tr>
<td height="2" bgcolor="#00892F"></td>
</tr>
</table></form>