$result=mysql_query($sql,$conn);
      
         while($row=mysql_fetch_array($result))
         {
          echo '<option>'.$row['department'].'</option>';//输出部门名 
      
         }

 原来它是在HTML里写的,正确写法

<td><select name='Depart'>
  <option>所有部门</option>";
       $conn=mysql_connect('localhost','root','%$!**') or die('连接失败');  //连接服务器
   mysql_select_db('lnwatchpc',$conn) or die('连接数据库失败');   //选择数据库
   mysql_query('SET NAMES utf8');       //设置字符集
         $sql='select department from depart';
         $result=mysql_query($sql,$conn);
        while($row=mysql_fetch_array($result))
       {
         echo '<option>'.$row['department'].'</option>';//输出部门名 
      
        }
         echo  "
      </select></td>

相关文章:

  • 2021-08-31
  • 2021-07-13
  • 2021-09-19
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-07-08
相关资源
相似解决方案