tengo un sistema hecho en php donde se me listan productos segun la categoria y deseo cambiarlo.. pues lo desarrolle en DW los famosos recordsets.. bueno pero aqui me lista de manera vertical.. ahora quiero listar 3 productos por fila
aqui estan mis codigos
Actual en DW
Código PHP:
   <?php require_once('Connections/multisillas.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$maxRows_Recordset1 = 30;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
 
$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
  $colname_Recordset1 = $_GET['id'];
}
mysql_select_db($database_multisillas, $multisillas);
$query_Recordset1 = sprintf("SELECT * FROM categoria WHERE id = %s", GetSQLValueString($colname_Recordset1, "int"));
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $multisillas) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
 
if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
 
mysql_select_db($database_multisillas, $multisillas);
$query_Recordset2 = "SELECT * FROM productos WHERE id_cat =".$row_Recordset1['id'];
$Recordset2 = mysql_query($query_Recordset2, $multisillas) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
 
 
 
?>
<link href="css/estilo.css" rel="stylesheet" type="text/css" />
<?php do { ?>
<table width="330" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" bgcolor="#CCCCCC"><table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="180" valign="top"><p><a href="esp_prod.php?id=<?php echo $row_Recordset2['id']; ?>"><span class="textoINDEX"><span class="textoMulti3"><br />
          <?php echo $row_Recordset2['nombre']; ?></span></span><br />
                  <br />
          </a><span class="textoINDEX"><span class="textotitResNot">Código:</span> <span class="textoMulti1"><?php echo $row_Recordset2['codigo']; ?></span></span></p>
            <p align="left"><span class="textoINDEX"><a href="ficha_prod.php?id=<?php echo $row_Recordset2['id']; ?>"><br />
                    <img src="imgs/boton_pro.jpg" width="112" height="22" border="0" /></a></span></p></td>
        <td width="19"> </td>
        <td width="100" valign="middle"><p align="justify" class="textoINDEX"><a href="esp_prod.php?id=<?php echo $row_Recordset2['id']; ?>"><img src="imgprod/<?php echo $row_Recordset2['imagen']; ?>" width="100" height="100" border="0" class="bordeimg" /></a></p></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center"> </td>
  </tr>
</table>
<?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
  
  <?php
mysql_free_result($Recordset1);
 
mysql_free_result($Recordset2);
?>    Código PHP:
   <?php include('Connections/incomed.php');
 
// Variables de Configuración -----------------------------------
// Define el numero de Filas
$n_filas=3;
 
//***************************************************************
@$cat=$_REQUEST['id'];
//$cat=6;
 
$fotos = array();
        $sql="SELECT * FROM imagenes where id_pro=".$producto_id."  ORDER BY id ASC";
mysql_select_db ('incomed');
    $sql_exec=mysql_query($sql);
    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);
 
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="100%" height="80"><table width="100%" height="80" border="0" align="center" cellpadding="0" cellspacing="0">
        
        <?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'];
                
                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['img']."' width='80' height='53' border='0'/></a>";
            
                $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>';
        ?>
        <?php /*if (empty($w)) {
        echo"<table width='0' border='0' align='center' cellpadding='0' cellspacing='0'>
          <tr>
            <td width='492'><div align='center'>No hay articulos en esta categoria </div></td>
          </tr>
        </table>
        ";
        exit;}
        */?>
    </table></td>
  </tr>
</table>    
 



