我无法解决这个Parse错误:语法错误,意外的T_WHILE

时间:2015-02-18 21:50:37

标签: php mysql

错误:解析错误:语法错误,C:\ Program Files(x86)\ EasyPHP-5.3.5.0 \ www \ Pharmaceutical Distribution System \ PDS \ add-department-1.php 149行的意外T_WHILE

这是我的php代码,用于从php mysql动态添加选项。

<div class="form-group">
 <label>Department</label>
 <select class="form-control" name="Department" required>
 <option>Select Department</option>
 <?php
    $link = mysqli_connect("127.0.0.1", "root", "");
    $SqlResult = mysqli_query($link, "SELECT department_name from department_master");
    mysql_select_db('pds',$link)
    while($Row = mysqli_fetch_array($SqlResult))
    {
      ?>
      <option value="<?php echo $Row['department_name']; ?>"></option>
    <?php 
    }
    ?>
    </select>
                                                                </div>

1 个答案:

答案 0 :(得分:1)

我已为你编辑

<div class="form-group">
         <label>Department</label>
         <select class="form-control" name="Department" required>
             <option>Select Department</option>
             <?php
                $link = mysqli_connect("127.0.0.1", "root", "");
                mysql_select_db('pds',$link);
                $SqlResult = mysqli_query($link, "SELECT department_name from department_master");

                while($Row = mysqli_fetch_array($SqlResult))
                {
                  ?>
                 <option value="<?php echo $Row['department_name']; ?>"><?php echo $Row['department_name']; ?></option>
                <?php 
                }
                ?>
        </select>
</div>