欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP+MySQL實現(xiàn)模糊查詢員工信息功能示例

 更新時間:2018年06月01日 11:37:52   作者:chengqiuming  
這篇文章主要介紹了PHP+MySQL實現(xiàn)模糊查詢員工信息功能,結(jié)合實例形式分析了php連接mysql數(shù)據(jù)庫及使用like語句進行模糊查詢與顯示相關操作技巧,需要的朋友可以參考下

本文實例講述了PHP+MySQL實現(xiàn)模糊查詢員工信息功能。分享給大家供大家參考,具體如下:

一、代碼

注意兩點:

1、用Notepad+編輯時,格式選擇:【編碼字符集】->【中文】->【gb2312】

2、

<meta http-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("set names gbk");
?>

index.php

<?php session_start(); include("conn/conn.php");?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> 查詢企業(yè)員工的詳細信息</title>
<style type="text/css">
<!--
.STYLE4 {font-size: 13px}
.STYLE5 {font-family: "華文琥珀"; font-size: 20px;}
.STYLE6 {color: #990000}
-->
</style>
</head>
<body>
<table width="450" height="28" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
  <td align="center" class="STYLE5 STYLE6">查詢企業(yè)員工的詳細信息</td>
 </tr>
</table>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<table width="450" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#990000">
 <tr>
  <td width="176" align="center" bgcolor="#FFFFFF"><span class="STYLE1 STYLE4">按照員工的編號查詢</span></td>
  <td width="182" bgcolor="#FFFFFF"><input name="number" type="text" id="number" /></td>
  <td width="84" height="25" bgcolor="#FFFFFF"><input type="hidden" name="flag" value="1" /><input name="submit" type="submit" value="提交" /></td>
 </tr>
</table>
</form>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#990000">
 <tr>
  <td width="67" align="center" bgcolor="#FFFFFF" class="STYLE4">編號</td>
  <td width="72" align="center" bgcolor="#FFFFFF" class="STYLE4">姓名</td>
  <td width="119" align="center" bgcolor="#FFFFFF" class="STYLE4">電話</td>
  <td width="182" height="25" align="center" bgcolor="#FFFFFF" class="STYLE4">地址</td>
 </tr>
 <?php
 if(isset($_POST["flag"]))
 {
   $query=mysql_query("select * from tb_employee where number like '%".$_POST["number"]."%'");
   if($query)
   {
     while($myrow=mysql_fetch_array($query))
     {
 ?>
 <tr>
  <td align="center" bgcolor="#FFFFFF" class="STYLE4"><span class="STYLE2"><?php echo $myrow[number];?></span></td>
  <td align="center" bgcolor="#FFFFFF" class="STYLE4"><span class="STYLE2"><?php echo $myrow[name];?></span></td>
  <td height="23" align="center" bgcolor="#FFFFFF" class="STYLE4"><span class="STYLE2"><?php echo $myrow[tel];?></span></td>
  <td height="23" align="center" bgcolor="#FFFFFF" class="STYLE4"><span class="STYLE2"><?php echo $myrow[address];?></span></td>
 </tr>
 <?php
     }
   }
 }
 ?>
</table>
</body>
</html>

二、運行結(jié)果

瀏覽器選擇的編碼是gbk

更多關于PHP相關內(nèi)容感興趣的讀者可查看本站專題:《php+mysql數(shù)據(jù)庫操作入門教程》、《php+mysqli數(shù)據(jù)庫程序設計技巧總結(jié)》、《php面向?qū)ο蟪绦蛟O計入門教程》、《PHP數(shù)組(Array)操作技巧大全》、《php字符串(string)用法總結(jié)》及《php常見數(shù)據(jù)庫操作技巧匯總

希望本文所述對大家PHP程序設計有所幫助。

相關文章

最新評論