Advertisement
Guest User

llenar select php mysql

a guest
Mar 2nd, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. <?php
  3. $conexion = new mysqli('localhost', 'cide', 'cidebd', 'bd_cide');
  4. ?>
  5. <select name="departamento" id="departamento">
  6. <?php
  7. $result = $conexion->query("SELECT idDepa, departamento FROM ubdepartamento");
  8. if ($result->num_rows > 0) {
  9. while ($row = $result->fetch_assoc()) {
  10. echo '<option value="'.$row['idDepa'].'">'.$row['departamento'].'</option>';
  11. }
  12. }
  13. ?>
  14. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement