PHP 板


LINE

› 看板 PHP  RSS
<? @session_start(); require("connect.php"); $current_pid = $_POST[current_pid]; $start = $_POST[start]; $end = $_POST[end]; $uid = $_SESSION["id"]; $str1 = "select * from WeekReport where wrstart = '$start' and wrend = '$end'"; $result1 = mysql_query($str1); echo mysql_num_rows($result1); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>产生周报</title> <link rel="stylesheet" href="table.css" type="text/css" /> <link rel="stylesheet" type="text/css" href="project_menu.css" /> <script type="text/javascript"> function generate_id() { var d=new Date(); var r="W"+d.getYear(); r+=d.getMonth()+1 < 10 ? "0"+(d.getMonth()+1) : (d.getMonth()+1); r+=d.getDate() < 10 ? "0"+d.getDate() : d.getDate(); r+=d.getHours() < 10 ? "0"+d.getHours() : d.getHours(); r+=d.getMinutes() < 10 ? "0"+d.getMinutes() : d.getMinutes(); document.getElementById('wid').value = r; document.getElementById('w_date').value = d.getYear() + "-" + ( d.getMonth()+1 < 10 ? "0"+d.getMonth()+1 : d.getMonth()+1) + "-" + (d.getDate() < 10 ? "0"+d.getDate() : d.getDate()); } function check() { if(window.confirm("确定要产生周报?")) { window.myform.submit(); } } </script> </head> <body onload="generate_id()"> <div id="masthead"> <img src="pic\Title.gif" alt="成大马达中心" width="856" height="64" /></div> <div id="container"> <div id="left_col"> <? include("project_menu_bar.php"); ?> </div> <div id="page_content"> <? if(mysql_num_rows($result1) != 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ { echo "该周报已经产生过了"; } else { /*$str2 = "select r.rid,r.date,r.start,r.end,p.pid,p.name,u.name as username,r.status from Record r,Project p,User u,PvsR pr,UserProject up where p.pid=pr.pid and r.rid=pr.rid and p.pid=up.CPJID and u.uid=up.CUID and u.uid='$uid' and r.date between '$start' and '$end' and p.pid='$current_pid' order by r.rid DESC";*/ $str = "select r.rid,r.date,r.start,r.end,u.name as writer,r.status,r.content from Record r,PvsR pr,Project p,User u where r.rid = pr.rid and p.pid = pr.pid and r.CUID = u.uid and p.pid = '$current_pid' and r.CUID = '$uid' and r.submit=0 and r.date between '$start' and '$end' order by r.rid DESC"; $result = mysql_query($str); ?> <form name="myform" method="post" action="generate_week_report.php" style="height: 280px"> <fieldset name="Group1" style="height: 198px"> <legend>搜寻结果</legend> <input name="current_pid" type="hidden" value="<? echo $current_pid;?>"> <input id="wid" name="wid" type="text"> <input id="w_date" name="date" type="text"> <table class="datatable"> <tr> <th>呈阅</th> <th>纪录编号</th> <th>纪录日期</th> <th>工作时程</th> <th>工作内容</th> <th>填写者</th> <th>状态</th> </tr> <? $i=1; while($row = mysql_fetch_object($result)) { echo "<tr>"; echo "<td><input name=\"submit[$i]\" type=\"checkbox\" value=\"1\"/></td>"; echo "<td>"; echo $row->rid; echo "<input name=\"rid[$i]\" type=\"hidden\" value=\"$row->rid\">"; echo "</td>"; echo "<td>"; echo $row->date; echo "</td>"; echo "<td>"; echo $row->start."~".$row->end; echo "</td>"; echo "<td>"; echo $row->content; echo "</td>"; echo "<td>"; echo $row->writer; echo "</td>"; echo "<td>"; if($row->status == 1) echo " 签核 "; else if($row->status == 2) echo " 提交 "; else if($row->status == 3) echo " 私人 "; else echo " 重提 "; echo "</td>"; $i += 1; echo "</tr>"; } $i = $i - 1; echo "<input name=\"sum\" type=\"text\" value=\"$i\">"; echo "<input name=\"start\" type=\"text\" value=\"$start\">"; echo "<input name=\"end\" type=\"text\" value=\"$end\">"; ?> </table> <p style="text-align: center"> <input onclick="check()" name="submit1" type="button" value="产生周报" style="color: #0000FF; background-color: #FFFF00" /></p> </fieldset> </form> <? } ?> </div> </div> 为什麽我想要检查改笔资料的报告是否产生过了,检查的方法是比对开始和结束日期 但是不管检查的结果是0还是1,都是显示周报已产生过的结果??为什麽啊?? --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.70.75.252
1F:推 shadowjohn :中间有藏了几个include,该不会名称有重叠? 02/03 01:29
2F:→ shadowjohn :include("project_menu_bar.php"); 这个看看 02/03 01:30
3F:推 j87b0003 :问题出在SQL吗? 02/03 01:30
4F:推 shadowjohn :比对的前一行再印一次echo 看看~ 02/03 01:32
5F:→ ROCKIT :谢谢一楼,解决了~~果然名称有重叠~= = 02/10 23:24







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:iOS 或 站内搜寻

TOP