php如何实现人员信息搜索的功能
导读:本文共2626.5字符,通常情况下阅读需要9分钟。同时您也可以点击右侧朗读,来听本文内容。按键盘←(左) →(右) 方向键可以翻页。
摘要: php实现人员信息搜索的功能的方法:1、创建conn.php文件连接人员信息数据库;2、创建index.php文件;3、通过“ if(isset($_POST["flag"])){...}”等语句实现人员搜索功能即可。本文操作环境... ...
音频解说
目录
(为您整理了一些要点),点击可以直达。
php实现人员信息搜索的功能的方法:1、创建conn.php文件连接人员信息数据库;2、创建index.php文件;3、通过“ if(isset($_POST["flag"])){...}”等语句实现人员搜索功能即可。
本文操作环境:Windows7系统,PHP7.1版,Dell G3电脑。
php怎么实现人员信息搜索的功能?
PHP+MySQL实现模糊查询员工信息功能示例
具体如下:
一、代码
注意两点:
1、用Notepad+编辑时,格式选择:【编码字符集】->【中文】->【gb2312】
2、
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
conn.php
<?php$connID=mysql_connect("localhost","root","root");mysql_select_db("db_database13",$connID);mysql_query("setnamesgbk");?>
index.php
<?phpsession_start();include("conn/conn.php");?><html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/><title>查询企业员工的详细信息</title><styletype="text/css"><!--.STYLE4{font-size:13px}.STYLE5{font-family:"华文琥珀";font-size:20px;}.STYLE6{color:#990000}--></style></head><body><tablewidth="450"height="28"border="0"align="center"cellpadding="0"cellspacing="0"><tr><tdalign="center"class="STYLE5STYLE6">查询企业员工的详细信息</td></tr></table><formname="form1"method="post"action="<?phpecho$_SERVER['PHP_SELF']?>"><tablewidth="450"border="0"align="center"cellpadding="0"cellspacing="1"bgcolor="#990000"><tr><tdwidth="176"align="center"bgcolor="#FFFFFF"><spanclass="STYLE1STYLE4">按照员工的编号查询</span></td><tdwidth="182"bgcolor="#FFFFFF"><inputname="number"type="text"id="number"/></td><tdwidth="84"height="25"bgcolor="#FFFFFF"><inputtype="hidden"name="flag"value="1"/><inputname="submit"type="submit"value="提交"/></td></tr></table></form><tablewidth="450"border="0"align="center"cellpadding="0"cellspacing="1"bgcolor="#990000"><tr><tdwidth="67"align="center"bgcolor="#FFFFFF"class="STYLE4">编号</td><tdwidth="72"align="center"bgcolor="#FFFFFF"class="STYLE4">姓名</td><tdwidth="119"align="center"bgcolor="#FFFFFF"class="STYLE4">电话</td><tdwidth="182"height="25"align="center"bgcolor="#FFFFFF"class="STYLE4">地址</td></tr><?phpif(isset($_POST["flag"])){$query=mysql_query("select*fromtb_employeewherenumberlike'%".$_POST["number"]."%'");if($query){while($myrow=mysql_fetch_array($query)){?><tr><tdalign="center"bgcolor="#FFFFFF"class="STYLE4"><spanclass="STYLE2"><?phpecho$myrow[number];?></span></td><tdalign="center"bgcolor="#FFFFFF"class="STYLE4"><spanclass="STYLE2"><?phpecho$myrow[name];?></span></td><tdheight="23"align="center"bgcolor="#FFFFFF"class="STYLE4"><spanclass="STYLE2"><?phpecho$myrow[tel];?></span></td><tdheight="23"align="center"bgcolor="#FFFFFF"class="STYLE4"><spanclass="STYLE2"><?phpecho$myrow[address];?></span></td></tr><?php}}}?></table></body></html>
二、运行结果
浏览器选择的编码是gbk
</div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:
php如何实现人员信息搜索的功能的详细内容,希望对您有所帮助,信息来源于网络。