php操作access数据库

这是一个PHP网页,用于查询考勤机软件的Access数据库中的考勤记录,并根据指定的姓名、开始时间和结束时间显示打卡记录。同时,它会检查是否存在对应的加班审批流程,如果存在,则提供链接查看审批表;若无,则提示未提交审批表。用户可以通过输入框输入查询条件,点击提交按钮进行查询。
摘要由CSDN通过智能技术生成
<?php
include_once("inc/auth.inc.php");
include_once("inc/utility_all.php");
include_once("inc/utility_file.php");
?>
<script src="My97DatePicker/WdatePicker.js"></script>

<p style="color:red;">注意:本功能不是直接查询考勤机数据,而是查询考勤机自带软件的access数据库,并非OA数据库;</p>
<form id="form1" name="form1" method="post" action="zhicha.php">
  开始时间:
  <label for="kaishi"></label>
  <input type="text" name="kaishi" id="kaishi" value="<?=$_REQUEST["kaishi"]?>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" />
结束时间:
<label for="jieshu"></label>
<input type="text" name="jieshu" id="jieshu" value="<?=$_REQUEST["jieshu"]?>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" />
姓名:
<label for="xingming"></label>
<input type="text" name="xingming" id="xingming" value="<?=$_REQUEST["xingming"]?>" />
<input type="submit" name="button" id="button" value="提交" />
</form>



<table width="500" border="1" cellpadding="0" cellspacing="0">
  <tr style="background-color:#66bff5; font-size:12px;">
    <td style="line-height:30px;" align="center">序号</td>
    <td align="center">打卡记录</td>
    <td align="center">加班审批流程</td>
  </tr>

<?PHP 
$weekarray=array("日","一","二","三","四","五","六");
$ACCESS_PATH = "C:\\Program Files\\Att\\att2000.MDB";
//echo $ACCESS_PATH;
$conn = @new COM("ADODB.Connection") or die ("ADO连接失败!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($ACCESS_PATH); 
$conn->Open($connstr); 
//echo $ACCESS_PATH;
	//查询是否有加班流程		13 14		
		//$query2 = "select * from flow_data_203 ,flow_run where flow_run.RUN_ID = flow_data_203.run_id and flow_run.END_TIME is NOT NULL and data_1 = '".$_REQUEST["xingming"]."' and  UNIX_TIMESTAMP(DATE_FORMAT( data_13, '%Y-%m-%d')) <= UNIX_TIMESTAMP('".date('Y-'.$yue.'-'.$i.' 00:00:00')."') and UNIX_TIMESTAMP(DATE_FORMAT( data_14, '%Y-%m-%d')) >= UNIX_TIMESTAMP('".date('Y-'.$yue.'-'.$i.' 00:00:00')."')";//查询这个人当天的这次打卡记录
	$query2 = "select * from flow_data_203 ,flow_run where flow_run.RUN_ID = flow_data_203.run_id  and data_1 ='".$_REQUEST["xingming"]."' and data_13 >= '".date('Y-m-d 00:00:00',(strtotime($_REQUEST["kaishi"])))."' and data_14 <= '".date('Y-m-d 23:59:59',(strtotime($_REQUEST["jieshu"])))."'";
				//echo $query2;
								
				$cursor2= exequery(TD::conn(),$query2);
				if($ROW2=mysql_fetch_array($cursor2))
				{
					//print_r($ROW2);
					//$jiabanliucheng++;
					$run_id2 = $ROW2["run_id"];
				}
				else
				{
					
				}


//创建记录集查询 
$rs = @new COM("ADODB.RecordSet"); 
$sql = "SELECT USERINFO.USERID, USERINFO.Name,checktime
FROM USERINFO INNER JOIN CHECKINOUT ON USERINFO.USERID = CHECKINOUT.USERID where name = '".$_REQUEST["xingming"]."' and checktime >= #".date('Y-m-d 00:00:00',(strtotime($_REQUEST["kaishi"])))."# and checktime <= #".date('Y-m-d 23:59:59',(strtotime($_REQUEST["jieshu"])))."# order by checktime desc";
//echo $sql;
$rs->Open($sql,$conn,1,3); 
//print_r($rs);
$i=1;
while(!$rs->eof)
{
	

	

?>

  <tr>
    <td align="center"><?=$i?></td>
    <td align="left" style="padding-left:10px;"><? echo $rs->Fields["CHECKTIME"]->Value;  ?>&nbsp;星期<?=$weekarray[date('w', strtotime($rs->Fields["CHECKTIME"]->Value))]?></td>
    <td align="center">
    <?php
    if($run_id2 !="" and $run_id2 !=0)
	{
	?>
     
     <a href='/general/workflow/list/print/index.php?actionType=view&MENU_FLAG=&RUN_ID=<?=$run_id2?>&PRCS_KEY_ID=&FLOW_ID=203' target='_blank'>加班审批表</a>
     <?php
	}else{
		
	 ?>
     <a style="color:#F00">未提交加班审批表</a>
     <?php
	}
	 ?>
     
     </td>
  </tr>
<?
    $rs->Movenext(); //将记录集指针下移 
	$i++;
}
$rs->close(); 

?>

</table> 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hai7425

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值