2013-05-29 18:28
浏览 95


i try to get data from mysql db into html dropdown , i execute the query in PHPmyadmin and its work fine , the result is one record,and all the website is connected with theses details of MYSQL my code is :

   mysql_connect("localhost", "root", "1212") or die("Connection Failed");
   mysql_select_db("test")or die("Connection Failed");
   $query = "SELECT department_name FROM department";
   $result = mysql_query($query);
  <label for="department" > Department Name </label>
  <select name="departments" >

    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

   <option value="<?php echo $line['field'];?>"> <?php echo $line['field'];?> </option>


the output is drop-down with one empty record , any one can help me in that ?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题