Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/03/2008, 11:43
Avatar de helthon
helthon
 
Fecha de Ingreso: junio-2005
Ubicación: Lima
Mensajes: 549
Antigüedad: 18 años, 10 meses
Puntos: 7
Re: Mostrar contenido de una tabla con un <select> y <option>

Prefiero trabajarlo asi:


Código PHP:
<?
  $conectar
=mysql_connect("localhost","root","");
  
$db="cutec";
  
$sql mysql_query("SELECT curso FROM curso ORDER BY idcurso");
?> 


<? if (mysql_num_rows($sql) > 0)   { ?>
<select name="select" id="select">
<?  while ($temp mysql_fetch_array($sql)) { ?>
  <option value="<? echo $temp["idcurso"]; ?>"><? echo $temp["curso"]; ?></option>
<? mysql_free_result($sql);?>  
</select>
<? }else{ ?>
No hay datos
<? ?>
__________________
HELTHON FUENTES
FLORERIA FLORES PERU Floresperu.com.pe
Garantizamos que cada entrega de flores será de la más alta calidad y frescura