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

📄 actual.php

📁 PHP4_0入门与提高源程序代码
💻 PHP
字号:
<?
include "config.php";
?>
<html>
<head>
<title><? print($view_current_month_title);?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<?
$datemonth=date("Y-m")."-00";	
      $monthend=date("Y-m")."-31";	//月份的最后一天
      $monthm=date("m")+1;	//下一个月份
	  $monthl=date("m")-1;	//上一个月份
      
      if($otmonth!='') { 
	  					//如果当前月份小于10,在数字前面补0
      					if($otmonth<10){ $otmonth='0'.$otmonth; }
      					//分别得出下一个月份和上一个月份
      					$monthm=$otmonth+1;
						$monthl=$otmonth-1;
      					
						//当前月份的第一天和最后一天
      					$datemonth=date("Y")."-$otmonth-00";
      					$monthend=date("Y")."-$otmonth-32";
      				   }
	
    if ($otmonth=='') $otmonth=date("m");  
?>

<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($view_current_month_title);?> - <? print ($otmonth);?></font></center><br><b>
      <? print("<center>".$current_amount);?></b>: $
      <?
      //从monthly表中查询月份统计记录
      $query="select * from monthly where date='$datemonth' and user='$uservalid'";
	  //连接数据库并做查询操作
      $mysql_link = mysql_connect($host,$user,$password);
	  mysql_select_db($bdd,$mysql_link);
	  $mysql_result = mysql_query($query, $mysql_link);
	  //把结果保存到数组中
	  $row = mysql_fetch_row($mysql_result);
	  if($row[0]!=''){ $status=$row[3]; }
	  //输出收支状态信息
	  print($status." - <b>".$total_expenses."</b>: $".$row[1]." - <b>".$total_in."</b>: $".$row[2]."</center>");
      ?>

      <table width="95%" bordercolor="#c0c0c0" border="1" 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 date>'$datemonth' and date <'$monthend' and user='$uservalid' order by date";
        $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>
<center>
<a href="actual.php?otmonth=<? print($monthl);?>">[<? print($back);?>]</a>
<a href="actual.php?otmonth=<? print($monthm);?>">[<? print($forward);?>]</a>
</center>
    </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 + -