Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2009, 08:51
hollowmanf
 
Fecha de Ingreso: enero-2009
Mensajes: 246
Antigüedad: 15 años, 4 meses
Puntos: 1
Problema con Combo en php

Hola amigos tengo el siguiente problema, necesito traer los datos guardados en mi db de 1 campo en un combo el cual luego el usaurio pueda seleccionar y enviar pero no logro que me liste los datos de mi combo. Coloco el php que tengo armado para ver si alguien puede ayudarme a ver donde tengo el error:

Código PHP:
<?PHP
require_once('config.php');
$link mysql_connect(DB_HOSTDB_USERDB_PASSWORD);
$db mysql_select_db(DB_DATABASE);
$resultmysql_query("select * from producto") or die('Error: '.mysql_error());  
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<form action="insert_suscripcion.php" method="post">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="38%" id="AutoNumber1">
  <tr>
    <td width="100%" colspan="4">Formulario de Pedido:</td>
  </tr>
  <tr>
    <td width="100%" colspan="4">
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</td>
  </tr>
  <tr>
    <td width="14%">Apellido:</td>
    <td width="86%" colspan="3"><input name="apellido" type="text" value="" size="59" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="14%">Nombre:</td>
    <td width="86%" colspan="3"><input name="nombre" type="text" value="" size="59" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="14%">Calle:</td>
    <td width="86%" colspan="3"><input name="calle" type="text" value="" size="59" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="15%">Numero:</td>
    <td width="35%">
        <select name='ejemplar_numero' id='ejemplar_numero'>
            <option value="1">Edicion numero 1</option>
            <?php
                
while (list($producto)=mysql_fetch_array($resultado)) {
                    if (
$ejemplar_numero == $defecto) {
                        echo 
"<option>$defecto</option>";
                    } else {
                        echo 
"<option>$ejemplar_numero</option>";
                    }
                } 
            
?>
        </option>
    </td>
    <td width="8%">CP.:</td>                            
    <td width="42%"><input name="cp" type="text" value="" size="21" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="15%">Piso:</td>
    <td width="35%"><input name="piso" maxlength="100" type="text" value="" /></td>
    <td width="8%">Localidad:</td>
    <td width="42%"><input name="localidad" type="text" value="" size="21" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="15%">Depto.:</td>
    <td width="35%"><input name="depto" maxlength="100" type="text" value="" /></td>
    <td width="12%">Provincia:</td>
    <td width="38%"><input name="provincia" type="text" value="" size="21" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="14%">Teléfono:</td>
    <td width="86%" colspan="3"><input name="telefono" type="text" value="" size="59" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="14%">E-mail:</td>
    <td width="86%" colspan="3"><input name="email" type="text" value="" size="59" maxlength="100" /></td>
  </tr>
  <tr>
    <td width="100%" colspan="4"><center><input name="boton" type="submit" value="Enviar" /></center></td>
  </tr>
</table>
</body>
</html>
Coloco aqui mi script de la DB:

Código PHP:
-- 
-- 
Estructura de tabla para la tabla `producto`
-- 

CREATE TABLE `producto` (
  `
Id_productoint(50NOT NULL auto_increment,
  `
ejemplar_numerovarchar(100NOT NULL,
  
PRIMARY KEY  (`Id_producto`)
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=;

-- 
-- 
Volcar la base de datos para la tabla `producto`
-- 

INSERT INTO `producto` (`Id_producto`, `ejemplar_numero`) VALUES 
(1'Ejemplar Nº 1'),
(
2'Suscripcion Anual'); 
y el dato que tengo que mostrar es el de ejemplar_numero.

Salu2 y gracias de antemano