PHP - Repetir region no funciona

 
Vista:
sin imagen de perfil

Repetir region no funciona

Publicado por Daniel (43 intervenciones) el 07/02/2016 12:13:33
Buenas,

pues escribo de nuevo en esta web a ver si consigo solución... no la encuentro por ningún lado y llevo mas de dos días con este problema.

El caso es que no me funciona el simple comando de repetir región y va a volverme loco. He hecho una prueba sencilla y nada, sólo me aparece el primer registro de mi base de datos y hay 25.

este es mi código, yo juraría que esta bien pero... no va:
ojalá consiga vuestra ayuda. Gracias!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php require_once('../Connections/mamp.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;
}
}
 
mysql_select_db($database_mamp, $mamp);
$query_paginacion = "SELECT * FROM disciplina";
$paginacion = mysql_query($query_paginacion, $mamp) or die(mysql_error());
$row_paginacion = mysql_fetch_assoc($paginacion);
$totalRows_paginacion = mysql_num_rows($paginacion);
 
mysql_free_result($paginacion);
?>
<?php do { ?>
  <table width="40%" border="2">
    <tbody>
      <tr>
        <td><?php echo $row_paginacion['nombre']; ?></td>
        <td><?php echo $row_paginacion['nombreprofe']; ?></td>
        <td><?php echo $row_paginacion['fecha1']; ?></td>
      </tr>
    </tbody>
  </table>
  <?php } while ($row_paginacion = mysql_fetch_assoc($paginacion)); ?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Repetir region no funciona

Publicado por xve (6935 intervenciones) el 07/02/2016 20:23:42
si utilizas un do {} while en vez de un while() {}, siempre te entrara en el bucle, aunque no dispongas de ningún registro.

mysql_free_result() elimina el resultado de la memoria... quítalo o simplemente ponlo al final de la pagina.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

Repetir region no funciona

Publicado por Daniel (43 intervenciones) el 07/02/2016 21:59:22
pues efectivamente,

eliminando la linea
mysql_free_result($paginacion);

se repiten los campos! lo extraño es que lo hice con dreamweaver tal cual la tabla, los registros y después en repetir región. No sé porque genera esa linea.

Ya van dos veces que me ayudas xve... muchísimas gracias de nuevo. Un saludo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar