Código PHP:
<?php include('conect.php');
$n_filas=3;
$fotos = array();
$sql="SELECT * FROM productos ORDER BY id ASC";
$sql_exec=mysql_query($sql) or die( "[ERROR] Query: $sql, error: " . mysql_error() );
$cuenta=mysql_num_rows($sql_exec);
function imagengrande()
{
window.open("verimagen.php?imagen=/iamges2/<?=$imagen;?>", "", "width=450,height=300");
}
/*while($row=mysql_fetch_assoc($sql_exec)){
$tottal=mysql_affected_rows(); // Calculo el numero total de itms a listar
}*/
$tottal=113;
$vert=$tottal/$n_filas;
$vert=round($vert);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GRUPO ALBARRACIN :::...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">td img {display: block;}body {
background-color: #EFF0D0;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
<!--Fireworks CS3 Dreamweaver CS3 target. Created Wed Jul 09 11:03:10 GMT-0400 2008-->
</head>
<body>
<table width="737" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!-- fwtable fwsrc="index2.png" fwpage="inmuebles" fwbase="inmuebles.jpg" fwstyle="Dreamweaver" fwdocid = "136311868" fwnested="0" -->
<tr>
<td><img src="images/spacer.gif" width="8" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="42" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="6" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="121" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="4" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="7" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="44" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="22" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="180" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="44" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="23" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="50" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="130" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="12" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="32" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="11" height="1" border="0" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="17"><img name="menu" src="images/menu.jpg" width="737" height="421" border="0" id="menu" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="421" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="17"><img name="inmuebles_r2_c1" src="images/inmuebles_r2_c1.jpg" width="737" height="6" border="0" id="inmuebles_r2_c1" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="6" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="17"><img name="linea_menu_bot" src="images/linea_menu_bot.jpg" width="737" height="36" border="0" id="linea_menu_bot" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="36" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="4"><img name="nuevos_titu" src="images/nuevos_titu.jpg" width="177" height="65" border="0" id="nuevos_titu" alt="" /></td>
<td colspan="9" rowspan="2" bgcolor="#FFFFFF"> </td>
<td colspan="4"><img name="inmuebles_titu" src="images/inmuebles_titu.jpg" width="185" height="65" border="0" id="inmuebles_titu" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="65" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="4"> </td>
<td colspan="4"> </td>
<td><img src="images/spacer.gif" width="1" height="43" border="0" alt="" /></td>
</tr>
<tr>
<td rowspan="23"><img name="inmuebles_r6_c1" src="images/inmuebles_r6_c1.jpg" width="8" height="1648" border="0" id="inmuebles_r6_c1" alt="" /></td>
<td colspan="15" rowspan="23" valign="top" bgcolor="#DBDCA0"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php
$a=0;// Colocando el contador horizontal en 0
$i=1;// Colocando el contador vertical en 0
$w=0;//Colocando un contador para el mensaje de "No hay articulos en esta acategoria"
while($row=mysql_fetch_assoc($sql_exec)){
$w=w+1;
if ($a==0){
echo '<tr>';
}
$a=$a+1;
$fotos[$i.'-'.$a] = $row['img'];
//aqui deberia dibujar la tabla pero como?
echo "<td height='80' width='53' border='0' ><a href=# onClick=\"window.open('verimagen.php?id=".$row['id']."; ','verimagen', 'width=530,height=470'); return false;\"><img src='images2/".$row['imgprinc']."' width='125' height='160' border='0'/></a></td><tr><td>".$row['titulo']."</td><tr><td>".$row['descripcion']."</td>";
$r=$a;// contador remanente para listar imagenes sin exceso
if ($a >= $n_filas) {
$a=0;// reiniciando el contador horizontal
$i=$i+1;// aumentando el contador vertical
echo '</tr>';
}if (empty($row)) {
echo"<table width='0' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='257'><div align='center'>No hay articulos en esta categoria </div></td>
</tr>
</table>
";
break 1;}
}
echo '</td>'; ?>