0

0

表单查询不到值。

php中文网

php中文网

发布时间:2016-06-23 13:27:08

|

987人浏览过

|

来源于php中文网

原创

如下代码

<?require('common.inc') ;show_user($ID);require('/php/acc/invoice/fun_list.inc');//require('list.inc');  //==========权限控制$size=3;        #表格中字体大小if($position=='') $position=0;if(!$page_row)$page_row=20;   #每页显示数据笔数//==================搜索方式确定==========================//echo    '<meta http-equiv="Content-Type" content="text/html" charset="gb2312">'.   '<LINK rel="stylesheet" type="text/css" href="//w3.yungtay.com.cn/sample/newform.css">'.   '<title>收据列表</title>'.   '<form ENCTYPE=multipart/form-data name=query_out action=acc_invoice_list.php>'.   '<body vlink=blue link=indigo>';   "<input type=hidden name=listkind value='$listkind'>   <input type =hidden id = sheet_no  value='$sheet_no'>   <input type =hidden id = contract_no  value='$contract_no'>   ";if($listkind=='LU')  {      echo "      <big><center><font color=crimson><h2>待签核</h2></font></center>     "; }elseif($listkind=='LM'){        echo "      <big><center><font color=crimson><h2>草稿/退件</h2></font></center>     "; }if($listkind=='ALL')  {     echo "           申请单号:<input type=text name=sheet_no size=10 maxlength=10>         申请人:<input type=text name=create_user size=5 maxlength=5>		 合约号:<input type=text name=contract_no size=10 maxlength=20>         <br>		 是否结案:  <select name=action_code><option value='$action_code'>                        <option value='Z'>已结案                        <option value='W'>未结案                        <option value=''>				     </select>        申请日期段:<input type=text name=s_date size=10 maxlength=10>-<input type=text name=e_date size=10 maxlength=10>             <input type=submit value=搜索>         <br><br>		 ";   }//申请开始日期作为查询条件  if($s_date!=''){      $create_dates1=" and trunc(a.create_date)>='$s_date' ";	}else{     $create_dates1=""; 	}//申请结束日期作为查询条件  if($e_date!=''){      $create_dates2=" and trunc(a.create_date)<='$e_date' ";   }else{     $create_dates2=""; }//是否结案作为查询条件if($action_code=='W'){      $action_codes=" and b.flow_code not like 'Z%' ";   }elseif($action_code=='Z'){       $action_codes=" and b.flow_code like 'Z%' ";   }else{     $action_codes=" ";  }//查询条件的类型if($listkind=='LM' or $listkind=='LU' ){     $c_from=",subflow c ";     $c_where="and  a.form_key=c.form_key"; 	}else{ 	     $c_from=" ";     $c_where=" ";}//查询条件的类型if($listkind=='LM') //退稿件{       $current_code="and c.current_user='$ID'  and a.creator='$ID'";}elseif($listkind=='LU'){   //待签核稿件      $current_code="and c.current_user='$ID' and a.creator<>'$ID' and b.flow_code<>'Z'";}else{      $current_code=""; 	  }		   $where="where  a.form_key=b.form_key  $c_where and  a.creator like '$create_user%'           and a.sheet_no like '$sheet_no%'          $create_dates1 $create_dates2 $action_codes $current_code";//acc_invoice为主表  查询数据总数	 $sel="select count(distinct a.sheet_no)       from acc_invoice a,flow b $c_from	  	  	  	  $where";$stmt=$dbh->prepare("$sel");$stmt->execute()||die("sel error");list($count_num)=$stmt->fetch();//空数据的提示if($count_num<1)  {      echo "     <P ALIGN=\"center\"><FONT COLOR=crimson size=18>无可查询文件	 <BR><A HREF=http://w3.yungtay.com.cn target=_parent>回首页 </A></FONT>";	 exit(); 	 }//输出表单echo "<table border=0 width=100%>      <tr align=center>      <th><font color=white>申请单号          <th><font color=white>帐套      <th><font color=white>合约号      <th><font color=white>金额           <th><font color=white>签核者	  <th><font color=white>签核日期	  <th><font color=white>操作	  </tr>	  ";$variable="$PHP_SELF?listkind=CQ&query=$query";//表单数据查询并取出数据$d_field="distinct a.sheet_no,a.creator,a.create_date,b.flow_code,          a.form_key,a.account_city,a.contract_no,a.par_value,is_print";	  $sel="select * from (select tt.*,rownum as rn                       from (select $d_field                               from acc_invoice a,flow b $c_from                             $where order by a.sheet_no desc) tt                      where rownum<=($page_row+$position))              where rn>$position";			  $stmt=$dbh->prepare("$sel");$stmt->execute()||die("sel error");$i=0;while(list($sheet_no,$creator,$create_date,$flow_code,$form_key,$account_city,$contract_no,$par_value,$is_print)=$stmt->fetch())   {      $selc="select current_user from subflow where form_key='$form_key'";      $stc=$dbh->prepare("$selc");      if($stc->execute())        {		list($current_user)=$stc->fetch(); 		}      $creator_name=name($creator);      $current_name=name($current_user);      $dept_name=get_depart_name($dept_no);	  	  /*      if($flow_code=='2') //==签核时抓取签核人员        {          $sql_str="select a.current_user,name(a.current_user)                    from subflow a,flow b                    where a.form_key=b.form_key and b.form_key='$form_key'                          and a.current_user='$ID'                          order by a.form_key,a.seq";		  //echo $sql_str;          $stmt_str=$dbh->prepare("$sql_str");          $stmt_str->execute()||die("sql_str error");          		  while(list($c_user,$c_user_name)=$stmt_str->fetch())               {                 $size=2;                 if($current_names=='') 				 { 				    $current_names=$c_user.$c_user_name; 				 }else{				    $current_names=$current_user.'-'.$current_name; 				 }               }        }else */		if($current_user=='00000' and $flow_code=='Z'){ 		     $size=''; 			 $current_names='结案'; 	    }else{ 		     $size=''; 			 $current_names=$current_user.'-'.$current_name; 	    }       if($i==0 or $i%2==0){	      $setcolor="line1";	   }else{	      $setcolor="line9";	   }	   	   if($is_print==1){	   	$oper="已列印";	   }else{	   	$oper="无操作";	   }	   	  $account= get_account_city($account_city);	  $fpar_value= number_format($par_value,2,'.',',');	  if($listkind=='LM'){//退稿件      echo   "       <tr>	   <td align=center id=$setcolor><a href='http://oracle.yungtay.com.cn/acc/invoice/acc_invoice1_c.php?sheet_no=$sheet_no&listkind=$listkind&form_key=$form_key' target='_parent'>$sheet_no</a></td>       <td align=center id=$setcolor>$account</td>       <td align=center id=$setcolor>$contract_no</td>       <td align=center id=$setcolor>$fpar_value</td>       <td align=center id=$setcolor>$current_names</td>	   <td align=center id=$setcolor>$create_date</td>	   <td align=center id=$setcolor><a href='http://oracle.yungtay.com.cn/acc/invoice/delete.php?sheet_no=$sheet_no'>删除</a></td>	   </tr>	   ";	   }else{	   echo   "       <tr>	   <td align=center id=$setcolor><a href='http://oracle.yungtay.com.cn/acc/invoice/acc_invoice1_c.php?sheet_no=$sheet_no&listkind=$listkind&form_key=$form_key' target='_parent'>$sheet_no</a></td>       <td align=center id=$setcolor>$account</td>       <td align=center id=$setcolor>$contract_no</td>       <td align=center id=$setcolor>$fpar_value</td>       <td align=center id=$setcolor>$current_names</td>	   <td align=center id=$setcolor>$create_date</td>	   <td align=center id=$setcolor>$oper</td>	   </tr>	   ";	   	   	   	   }	          $i=$i+1;	      }echo "</form></table>";//分页数据query_list($count_num,$page_row,$position,$variable);?>

在页面上,点击查询之后查不到合约号,就是按合约号查询的时候查不到条件的合约号,如查询合约号等于1的部分,点击查询之后查到的却是所有数据,求大神帮忙!


回复讨论(解决方案)

看看你实际执行的 SQL 指令

看看你实际执行的 SQL 指令


版主,sql命令不是上边代码有写么。。。你说的是后台处理之后的sql语句么?

jQuery省市二级联动关联店面查询表单代码
jQuery省市二级联动关联店面查询表单代码

JQuery是继prototype之后又一个优秀的Javascript库。它是轻量级的js库 ,它兼容CSS3,还兼容各种浏览器(IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+),jQuery2.0及后续版本将不再支持IE6/7/8浏览器。jQuery使用户能更方便地处理HTML(标准通用标记语言下的一个应用)、events、实现动画效果,并且方便地为网站提供A

下载

数据库中是否有记录?
先在db中直接执行sql看看。
然后再看代码生成的sql是否有错。

谢谢两位,结贴。

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
pixiv网页版官网登录与阅读指南_pixiv官网直达入口与在线访问方法
pixiv网页版官网登录与阅读指南_pixiv官网直达入口与在线访问方法

本专题系统整理pixiv网页版官网入口及登录访问方式,涵盖官网登录页面直达路径、在线阅读入口及快速进入方法说明,帮助用户高效找到pixiv官方网站,实现便捷、安全的网页端浏览与账号登录体验。

616

2026.02.13

微博网页版主页入口与登录指南_官方网页端快速访问方法
微博网页版主页入口与登录指南_官方网页端快速访问方法

本专题系统整理微博网页版官方入口及网页端登录方式,涵盖首页直达地址、账号登录流程与常见访问问题说明,帮助用户快速找到微博官网主页,实现便捷、安全的网页端登录与内容浏览体验。

194

2026.02.13

Flutter跨平台开发与状态管理实战
Flutter跨平台开发与状态管理实战

本专题围绕Flutter框架展开,系统讲解跨平台UI构建原理与状态管理方案。内容涵盖Widget生命周期、路由管理、Provider与Bloc状态管理模式、网络请求封装及性能优化技巧。通过实战项目演示,帮助开发者构建流畅、可维护的跨平台移动应用。

91

2026.02.13

TypeScript工程化开发与Vite构建优化实践
TypeScript工程化开发与Vite构建优化实践

本专题面向前端开发者,深入讲解 TypeScript 类型系统与大型项目结构设计方法,并结合 Vite 构建工具优化前端工程化流程。内容包括模块化设计、类型声明管理、代码分割、热更新原理以及构建性能调优。通过完整项目示例,帮助开发者提升代码可维护性与开发效率。

20

2026.02.13

Redis高可用架构与分布式缓存实战
Redis高可用架构与分布式缓存实战

本专题围绕 Redis 在高并发系统中的应用展开,系统讲解主从复制、哨兵机制、Cluster 集群模式及数据分片原理。内容涵盖缓存穿透与雪崩解决方案、分布式锁实现、热点数据优化及持久化策略。通过真实业务场景演示,帮助开发者构建高可用、可扩展的分布式缓存系统。

54

2026.02.13

c语言 数据类型
c语言 数据类型

本专题整合了c语言数据类型相关内容,阅读专题下面的文章了解更多详细内容。

29

2026.02.12

雨课堂网页版登录入口与使用指南_官方在线教学平台访问方法
雨课堂网页版登录入口与使用指南_官方在线教学平台访问方法

本专题系统整理雨课堂网页版官方入口及在线登录方式,涵盖账号登录流程、官方直连入口及平台访问方法说明,帮助师生用户快速进入雨课堂在线教学平台,实现便捷、高效的课程学习与教学管理体验。

15

2026.02.12

豆包AI网页版入口与智能创作指南_官方在线写作与图片生成使用方法
豆包AI网页版入口与智能创作指南_官方在线写作与图片生成使用方法

本专题汇总豆包AI官方网页版入口及在线使用方式,涵盖智能写作工具、图片生成体验入口和官网登录方法,帮助用户快速直达豆包AI平台,高效完成文本创作与AI生图任务,实现便捷智能创作体验。

598

2026.02.12

PostgreSQL性能优化与索引调优实战
PostgreSQL性能优化与索引调优实战

本专题面向后端开发与数据库工程师,深入讲解 PostgreSQL 查询优化原理与索引机制。内容包括执行计划分析、常见索引类型对比、慢查询优化策略、事务隔离级别以及高并发场景下的性能调优技巧。通过实战案例解析,帮助开发者提升数据库响应速度与系统稳定性。

56

2026.02.12

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
PHP面向对象基础课程(更新中)
PHP面向对象基础课程(更新中)

共12课时 | 0.7万人学习

Vue.js 微实战--十天技能课堂
Vue.js 微实战--十天技能课堂

共18课时 | 1.2万人学习

Swoft2.x速学之http api篇课程
Swoft2.x速学之http api篇课程

共16课时 | 1万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号