<select>中文乱码

在web.config中加入红色行代码即可  

<system.web>

    <globalization requestEncoding="gb2312"  responseEncoding="gb2312" />
    <sessionState mode="InProc" timeout="30" />
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>
  </system.web>
``` <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="java.sql.*"%> <table border="1"> <tr> <th>身份证号</th><th>密码</th><th>姓名</th><th>性别</th><th>单位</th> <th>电话</th><th>单位地址</th><th>邮箱</th><th>报考类别</th><th>备注</th><th>操作</th> </tr> <tr> <td>身份证号</td><td>密码</td><td>姓名</td><td>性别</td><td>单位</td> <td>电话</td><td>单位地址</td><td>邮箱</td><td>报考类别</td><td>备注</td><td><a href="">修改</a>|<a href="">删除</a></td> </tr> <% try{ Class.forName("com.mysql.jdbc.Driver"); }catch (ClassNotFoundException e){ out.println("数据加载失败:"+e.toString()); } Connection con=null; PreparedStatement pstmt=null; ResultSet rs =null; try{ con=DriverManager.getConnection("jdbc:mysql://localhost:3306/bmdb?useSSL=false","root","123456"); //2、创建数据库的访问连接 pstmt=con.prepareStatement("select * from dm");//3、获取sql执行对象 rs=pstmt.executeQuery();//5、执行sql获得结果集 while(rs.next()){//6、根据查询结果判断是否登陆成功 %> <tr> <td>身份证号</td><td>密码</td><td>姓名</td><td>性别</td><td>单位</td> <td>电话</td><td>单位地址</td><td>邮箱</td><td>报考类别</td><td>备注</td><td><a href="">修改</a>|<a href="">删除</a></td> </tr> <% }catch (SQLException e){ out.println("SQL异常:"+e.toString()); }finally { rs.close(); pstmt.close(); con.close(); } %> </table>```修改图中的信息,改为正确的代码
03-29
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>欢迎来到我的御书房</title> <style> .style1{ font-family: "Times New Roman", Times, serif; font-size: 16px; line-height: 1.6; color: #333; } a { text-decoration: none; } table { width: 1000px; border-collapse: collapse; background: linear-gradient(to right, #e0eafc, #cfdef3); } th, td { border: 1px solid #ddd; padding: 8px; text-align: left; border: 1px solid #ddd; padding: 5px; } th { background-color: #f2f2f2; text-align: center; } th:hover { color: #0056b3; /* 鼠标悬停时颜色稍变深 */ } tr:nth-child(odd) { background-color: #f2f2f2; } </style> </head> <?php include("conn.php"); ?> <body> <div id="apDiv1" align="center"><img src="lili3277.jpg" width="796" height="108" /></div> <div id="apDiv2"> <table width="867" border="0" align="center" > <tr> <th width="105"><span class="style1"><?PHP echo date("Y-m-d"); ?></span></th> <th width="114"><span class="style1"><a href="index.php">首页</a></span></th> <th width="125"><span class="style1"><a href="borrow.php">浏览信息</a></span></th> <th width="116"><span class="style1"><a href="add.php">添加图书</a></span></th> <th width="102"><span class="style1"><a href="search.php">简单查询</a></span></th> <th width="93"><span class="style1"><a href="searchmore.php">复杂查询</a></span></th> <th width="90"><span class="style1"><a href="group.php">分组统计</a></span></th> <th width="88"><span class="style1"><a href="quit.php">退出系统</a></span></th> </tr> </table> </div> <div id="apDiv3"> <form id="forml" name="forml" action="" method="post"> <table width="778" border="1" align="center"> <tr> <th width="97"><a href=" ?od=id" class="style1">图书编号</a></th> <th width="93"><a href=" ?od=bookname" class="style1">图书名称</a></th> <th width="95"><a href=" ?od=issuDate" class="style1">出版日期</a></th> <th width="93"><a href=" ?od=price" class="style1">图书定价</a></th> <th width="57"><a href=" ?od=maker" class="style1">作者</a></th> <th width="76"><a href=" ?od=publisher" class="style1">出版社</a></th> <th width="92"><span class="style1">操作</span></th> </tr> <?php $od=$_GET[od]; if($od==""){ $sql="select * from tb_book order by id desc limit 12";}else{ $sql="select * from tb_book order by ".$od." desc limit 12"; } $result=mysqli_query($conn,$sql); while($myrow=mysqli_fetch_array($result)){ ?> <tr> <td><div align="center"><span class="style1"><?php echo $myrow[0]; ?></span></div></td> <td><div align="center"><span class="style1"><?php echo $myrow[1]; ?></span></div></td> <td><div align="center"><span class="style1"><?php echo $myrow[2]; ?></span></div></td> <td><div align="center"><span class="style1"><?php echo $myrow[3]; ?></span></div></td> <td><div align="center"><span class="style1"><?php echo $myrow[4]; ?></span></div></td> <td><div align="center"><span class="style1"><?php echo $myrow[5]; ?></span></div></td> <td><div align="center"><span class="style1"><a href="del.php?id=<? echo $myrow[0]?>">删除</a>/<a href="update.php?id=<? echo $myrow[0]?>">修改</a></span></div></td> </tr> <?php }?> </table> </form> </div> <div id="apDiv4"> <p align="center">版权所有:22电子商务专业</p> <p align="center">校址:安徽省池州市教育园区</p> </div> </body> </html> 这个代码显示出的图书名称等信息是乱码,帮我分析一下什么问题, <?php $conn = mysqli_connect("localhost", "root", "root", "db_database18") or die("连接数据库服务器失败!".mysqli_connect_error()); mysqli_query($conn,"set name utf8"); ?> 上面这个是数据库连接文件,图书信息在数据库里可以正常显示
最新发布
06-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值