![Patada](http://static.forosdelweb.com/fdwtheme/images/smilies/footinmouth.png)
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
Código PHP:
<?Php
$servidor = "localhost";
$usuario_bd = "root";
$password_bd = "";
$basedatos = "empresa";
$conexion = mysql_connect($servidor,$usuario_bd,$password_bd);
if (!$conexion)
{
echo "Error conectando a la base de datos.";
exit();
}
$resultado=mysql_select_db($basedatos,$conexion);
if (!$resultado)
{
echo "Error seleccionando la base de datos.";
exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin título</title>
</head>
<body>
<select name="sel_vend" id="sel_vend">
<?php
$cod_ve = array();
$cod_vn = array();
$consulta= "SELECT consulta1,nombre_consulta FROM consulta WHERE order by consulta1";
$resultado = mysql_query($consulta,$conexion) or die('La consulta falló: ' . mysql_error());
while($linea = mysql_fetch_array($resultado)){
echo " <option value=\"".$linea[0]."\">".$linea[1]."</option>\n";
}
?>
</select>
</body>