Ver Mensaje Individual
  #3 (permalink)  
Antiguo 20/02/2011, 03:34
educacanis
 
Fecha de Ingreso: octubre-2010
Ubicación: Madrid
Mensajes: 295
Antigüedad: 13 años, 6 meses
Puntos: 12
Respuesta: Distribuir resultados de una consulta en una tabla

Gracias por ayudarme pero no he sabido incluirlo... me ha salido el principio de la tabla, pero no me saca los registros cuando lo he incluido... te dejo el código para ver si me puedes ayudar a incluirlo... el "while" está en la tabla incluido...

Código PHP:
<?php require_once('Connections/conexion_libros.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$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_catalogo_imag 10;
$pageNum_catalogo_imag 0;
if (isset(
$_GET['pageNum_catalogo_imag'])) {
  
$pageNum_catalogo_imag $_GET['pageNum_catalogo_imag'];
}
$startRow_catalogo_imag $pageNum_catalogo_imag $maxRows_catalogo_imag;

mysql_select_db($database_conexion_libros$conexion_libros);
$query_catalogo_imag "SELECT * FROM establecimientos";
$query_limit_catalogo_imag sprintf("%s LIMIT %d, %d"$query_catalogo_imag$startRow_catalogo_imag$maxRows_catalogo_imag);
$catalogo_imag mysql_query($query_limit_catalogo_imag$conexion_libros) or die(mysql_error());
$row_catalogo_imag mysql_fetch_assoc($catalogo_imag);

if (isset(
$_GET['totalRows_catalogo_imag'])) {
  
$totalRows_catalogo_imag $_GET['totalRows_catalogo_imag'];
} else {
  
$all_catalogo_imag mysql_query($query_catalogo_imag);
  
$totalRows_catalogo_imag mysql_num_rows($all_catalogo_imag);
}
$totalPages_catalogo_imag ceil($totalRows_catalogo_imag/$maxRows_catalogo_imag)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<table border="1">
  <tr>
    <td>Imagen 1</td>
    <td>Imagen 2 </td>
    <td>Tipo</td>
    <td>Precio</td>
    <td>Nombre</td>
    <td>Descripcion</td>
  </tr>
  
  <?php do { ?>
    <tr>
        <?php do { ?>
      <td><img src="<?php echo $row_catalogo_imag['url']; ?>" / ></td>
          <?php } while ($row_catalogo_imag mysql_fetch_assoc($catalogo_imag)); ?>

      <td><?php echo $row_catalogo_imag['Provincia']; ?></td>
      <td><?php echo $row_catalogo_imag['Nombre']; ?></td>
      <td><?php echo $row_catalogo_imag['Localidad']; ?></td>
    </tr>
    <?php } while ($row_catalogo_imag mysql_fetch_assoc($catalogo_imag)); ?>

</table>
</body>
</html>
<?php
mysql_free_result
($catalogo_imag);
?>

Gracias por tu ayuda