<?
$sql2=mysql_query("select * from p where indice='$usu'",$con);
while($row2 = mysql_fetch_array($sql2)){
$numelentos = count($row2['producto']);
for ($i=2; $i < $numelentos; $i++)
{
print ("$row2[$i] <BR>\n");
}
$sql3=mysql_query("select * from c where productoId='$row2[$i]'",$con);
$row3 = mysql_fetch_array($sql3);
$usu3=$row3['nombre'];
$usu31=$row3['imagen'];
if (!isset($pg))
$pg = 0;
$cantidad=5;
$inicial = $pg * $cantidad;
$pegar = "SELECT * FROM i
WHERE (nombre like '%.gif' or nombre like '%bmp' or nombre like '%jpg') and
nomProducto='$usu3' and nombre= '$usu31' ORDER BY nombre LIMIT $inicial,$cantidad";
$cad = mysql_db_query($bd_base,$pegar) or die (mysql_error());
$contar = "SELECT * FROM i
WHERE (nombre like '%.gif' or nombre like '%bmp' or nombre like '%jpg') and nomProducto='$usu3' and nombre= '$usu31' ORDER BY nombre";
$contarok= mysql_db_query($bd_base,$contar);
$total_records = mysql_num_rows($contarok);
$pages = intval($total_records / $cantidad);
while($array = mysql_fetch_array($cad)) {
echo "<td><a href= 'd.php?nombre=".$array['nombre']."'
(".$array['nombre']." )><img src=".$array['nombre'] ." width=200 height=150 border=2></a></td>";
}
}
echo "<p class=fonty>";
if ($pg != 0) {
$url = $pg - 1;
echo "<a href='$PHP_SELF?pg=".$url."'>« Anterior</a> ";
} else {
echo " ";
}
for ($i = 0; $i <= $pages; $i++) {
if ($i == $pg) {
if ($i == "0") {
echo "<b> 1 </b>";
} else {
$i = $i+1;
echo "<b> ".$i." </b>";
}
} else {
if ($i == "0") {
echo "<a href=$PHP_SELF?pg=".$i.">1</a> ";
} else {
echo "<a href='$PHP_SELF?pg=".$i."'>";
$i = $i+1;
echo $i."</a> ";
}
}
}
if ($pg < $pages) {
$url = $pg + 1;
echo "<a href='$PHP_SELF?pg=".$url."'>NEXT »</a>";
} else {
echo " ";
}
echo "</p>";
?>





Modo lineal
