Foros del Web » Programando para Internet » PHP »

Como mostrar todos mis registros de BDD en tabla?

Estas en el tema de Como mostrar todos mis registros de BDD en tabla? en el foro de PHP en Foros del Web. Hola No puedo acomodar los registros que tengo en una tabla, tengo esto: <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ...
  #1 (permalink)  
Antiguo 03/10/2011, 21:53
 
Fecha de Ingreso: septiembre-2011
Mensajes: 5
Antigüedad: 12 años, 7 meses
Puntos: 0
Pregunta Como mostrar todos mis registros de BDD en tabla?

Hola
No puedo acomodar los registros que tengo en una tabla, tengo esto:
<?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;
}
}
//$ctrttext=$_POST['bskctrt'];
$colname_ctrt = "-1";
if (isset($_POST['bskctrt'])) {
$colname_ctrt = $_POST['bskctrt'];
}
mysql_select_db($database_Obra, $Obra);
$query_ctrt = sprintf("SELECT fac_sol, fac_resp, bd_sol, bd_res, io_rec, io_res, to_rec, to_ed, rd, rd_res FROM ppal WHERE ctrt = %s", GetSQLValueString($colname_ctrt, "text"));
$ctrt = mysql_query($query_ctrt, $Obra) or die(mysql_error());
$row_ctrt = mysql_fetch_assoc($ctrt);
$totalRows_ctrt = mysql_num_rows($ctrt);
?>
<table width="200" border="0">
<tr>/////////////////////////////////////////////////////////////Aqui es el dilema
<th scope="col"><?php echo $row_ctrt['fac_sol']; ?></th>
<th scope="col"><?php echo $row_ctrt['fac_resp']; ?></th>
<th scope="col"><?php echo $row_ctrt['bd_sol']; ?></th>
<th scope="col"><?php echo $row_ctrt['bd_res']; ?></th>
<th scope="col"><?php echo $row_ctrt['io_rec']; ?></th>
<th scope="col"><?php echo $row_ctrt['io_res']; ?></th>
<th scope="col"><?php echo $row_ctrt['to_rec']; ?></th>
<th scope="col"><?php echo $row_ctrt['to_ed']; ?></th>
<th scope="col"><?php echo $row_ctrt['rd']; ?></th>
<th scope="col"><?php echo $row_ctrt['rd_res']; ?></th>

</tr>
</table>
<p>&nbsp;</p>
</form>
<p>&nbsp; </p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($ctrt);
?>
pero claro que solo me muestra un dato de todos los que tengo, tenia un while pero me repetia el mismo dato, solo necesito saber como mostrar todos los datos y no se como hacer el while Gracias de antemano y este mismo codigo les sirve y tengo un loguin que les puede servir (en php)
  #2 (permalink)  
Antiguo 03/10/2011, 23:35
 
Fecha de Ingreso: abril-2011
Mensajes: 33
Antigüedad: 13 años
Puntos: 7
Respuesta: Como mostrar todos mis registros de BDD en tabla?

Usa un ciclo wile con mysql_fetch_array
  #3 (permalink)  
Antiguo 04/10/2011, 09:42
 
Fecha de Ingreso: septiembre-2011
Mensajes: 5
Antigüedad: 12 años, 7 meses
Puntos: 0
Respuesta: Como mostrar todos mis registros de BDD en tabla?

Gracias solo que es lo que no recordaba jeje ya lo solucione

Etiquetas: html, mysql, registro, registros, sql, tabla, bbdd
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:23.