Ver Mensaje Individual
  #17 (permalink)  
Antiguo 21/04/2009, 13:08
TIFORO
 
Fecha de Ingreso: junio-2008
Ubicación: Madrid
Mensajes: 374
Antigüedad: 15 años, 10 meses
Puntos: 1
Respuesta: Select dinamico

Hola.

Mira asi no me funciona:

Código PHP:
$sql "SELECT nombre FROM id_usuarios";   
//aca saco el limit para que seleccione todos los registros   
$consulta_numero1 mysql_query($sql,$conexion);  
$total_registros mysql_result($consulta_numero1,"registros");

while(list(
$nombre) = mysql_fetch_row($consulta_numero1)) {  

}  

echo 
"$nombre-----<br>".$nombre;
echo 
"$total_registros<br>".$total_registros
Código HTML:
<!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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form>
<select name="nombre">   
<option value="<?php echo $nombre;?>"><?php echo $nombre;?></option> 
</select>
</form>
</body>
</html> 
Asi se me funciona pero no extrae solo uno:

Código PHP:
$sql "SELECT nombre FROM id_usuarios";   
//aca saco el limit para que seleccione todos los registros   
$consulta_numero1 mysql_query($sql,$conexion);  
$total_registros mysql_result($consulta_numero1,"registros");

while(list(
$nombre) = mysql_fetch_row($consulta_numero1)) {  

}  

echo 
"$nombre-----<br>".$nombre;
echo 
"$total_registros<br>".$total_registros
Código HTML:
<!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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form>
<select name="total_registros">  
<option value="<?php echo $total_registros;?>"><?php echo $total_registros;?></option> 
</select>
</form>
</body>
</html> 
Y lo que quiero es extraer todos los campos de la base de datos.

Vuelva a visitar http://www.contacto-caliente.com/ttt.php
__________________
Cada día se aprende algo nuevo