<?php $db=new MySQLi("localhost","账号","密码","数据库名"); $sql="select * from 表名"; $r= $db->query($sql); //执行SQL语句 $attr=$r->fetch_all(); foreach($attr as $v) //遍历数组 { echo "<option value='{$v[0]}'>{$v[1]}</option>"; } ?>
posted on 2016-05-10 10:54 肖旭 阅读(135) 评论(0) 编辑 收藏 举报