通过result.php查">
时间:2021-07-01 10:21:17 帮助过:19人阅读
//从数据库把班级名称取出来放入下拉列表中
mysql_connect("localhost","root","root") or die("数据库连接失败");
mysql_select_db("studentmanage") or die("数据库不存在");
$sql="select * from class";
$rs=mysql_query($sql);
$info=array();
while($row=mysql_fetch_assoc($rs)){
$info[]=$row;
}
?>
查询学生信息
请选择班级:
//header("content-type:text/html;charset=utf-8");
header("Content-type:text/xml;charset=utf-8");
header("Cache-Control:no-cache");
$class=$_POST['class'];
mysql_connect("localhost","root","root") or die("数据库连接失败");
mysql_select_db("studentmanage");
mysql_query("set names utf-8");
$sql="select * from student where cid='$class'";
//$sql="select * from student where cid=3";
$rs=mysql_query($sql);
$info=array();
while($row=mysql_fetch_assoc($rs)){
$info[]=$row;
}
$result="
学号 | 姓名 | 住址 | 班级 |
{$v['sid']} | {$v['name']} | {$v['address']} | {$v['cid']} |