dongpa2000
2016-06-15 02:45
浏览 416
已采纳

如何从数据库中获取值并在下拉列表中显示

I already try many ways but the value didn't show in dropdown list
Here, this is my code. can you suggest me anything that i was wrong

<?php  
$result = mysqli_query($con,"SELECT * FROM project"); 

    if( mysqli_num_rows( $result )==0){
    echo "<tr><td>No Rows Returned</td></tr>";
  }else{
    $row = mysqli_fetch_assoc( $result );
      $pos = 0;
      echo "<select name=Pname >"; 
        while($pos <= count ($row)){ 
      echo "<option value="$row["project_no"]">"$row["project_name"]"</option>";
           $pos++;
          }
echo "</select>";?>

And i write as .php file. Thanks for your help.

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

3条回答 默认 最新

相关推荐 更多相似问题