Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/10/2011, 21:53
not_stonedraiders
 
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)