标签:
<?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>"; } ?>
标签:
原文地址:http://www.cnblogs.com/zbxiaoxu/p/5477006.html