⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchaction.php

📁 PHP4_0入门与提高源程序代码
💻 PHP
字号:
<?
include "config.php";	//包含config.php文件
?>
<html>
<head>
<title><? print ($search_title);?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
    <td> 
      <center> <font face="Times New Roman, Times, serif" size="5"><? print ($search_title);?></font></center><br><b>
      <?
	  //建立与数据库的连接
      $mysql_link = mysql_connect($host,$user,$password);
	  //选择数据库
	  mysql_select_db($bdd,$mysql_link);
?>       
      <table width="95%" border="0" cellspacing="2" cellpadding="2" align="center">
        <tr bgcolor="#000099"> 
          <td align="center" width="10%"><font color="#FFFFFF"><? print($type_transaction);?> </font></td>
          <td align="center" width="11%"><font color="#FFFFFF"><? print($how_much);?></font></td>
          <td width="68%" align="center"><font color="#FFFFFF"><? print($description);?></font></td>
          <td width="11%" align="center"><font color="#FFFFFF"><? print($date_name);?></font></td>
        </tr>
        <?
		//构造查询语句
        $query="select * from expenses where description like '%$description_has%'"; 
		//如果$type变量非空,向查询语句中加入类型
        if($type!='') $query=$query." and type='$type'";
		//如果金额范围非空,向查询语句中加入金额范围
        if($all!="on") $query=$query." and money>'$min' and money<'$max'";
        if ($month>-1) 
             {
              $datemin=date("Y-$month-00");
              $datemax=date("Y-$month-31");
			  //向查询语句中加入日期查询
              $query=$query." and date >'$datemin' and date<'$datemax'";
             }
		 //加入用户信息
         $query=$query." and user='$uservalid'";      
		//执行查询
        $mysql_result = mysql_query($query, $mysql_link);
        $color='';
        $color2="#CCCCCC";
	  	
		//输出查询结果
	    while($row = mysql_fetch_row($mysql_result))
	        {
	        ?>
	        <tr bgcolor="<? print($color);?>">
	        <td width="10%" align="center"><? print($row[3]);?></td>
            <td width="11%" align="center" bgcolor="<? print($color2);?>">$<? print($row[1]);?></td>
            <td width="68%"><? print($row[2]);?></td>
            <td width="11%" align="center" bgcolor="<? print($color2);?>"><? print($row[4]);?></td>
            </tr>
	        <?
	        if($color=='') { $color="#CCCCCC"; $color2="FFFFFF";}
	        else { $color=''; $color2="#CCCCCC";}
	        }
        ?>
              </table>
              <br><br>
    </td>
  </tr>
<tr>
<form action="main.php" method="post">
<tr><td align="center"><input type="submit" value="<? print($go_back);?>">
</td></tr></form>  
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -