>백엔드 개발 >PHP 튜토리얼 >,请问个php数据处理的有关问题

,请问个php数据处理的有关问题

WBOY
WBOY원래의
2016-06-13 10:09:47914검색

高手请进,请教个php数据处理的问题
用php和mysql实现一个病人预约就诊统计功能:
默认加载页面的时候显示所有到诊的数据,也可以输入就诊日期的期间进行搜索:
现在要实现这个功能要怎么实现,下面的代码是我现在实现的部分,可能写得不正确,请高手帮忙实现这个功能。


mysql数据表结构 CREATE TABLE `yuyue` (
  `id` int(11) NOT NULL auto_increment, 'id自动编号
  `fangshi` varchar(250) default NULL, ‘预约方式:分为网络和电话
  `yydate` varchar(250) default NULL, ’预约日期
  `djdate` varchar(250) default NULL, ’登记日期
  `dzhen` int(11) default '0', ’是否到诊:0还,1是
  `dzdate` varchar(250) default NULL, '到诊日期 
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2333 DEFAULT CHARSET=utf8;


function.inc.php

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpfunction dzdate($sql,$date1,$date2)    {            if( !empty($date1) && !empty($date2) ){            $sql = $sql." and `dzdate` >= '$date1' and `dzdate` 



PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phprequire_once ('inc/function.inc.php');header("Content-Type: text/html; charset=utf-8");require_once('inc/mysql.inc.php');$weekname=array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');?><script language="javascript" src="images/date.js"></script><style type="text/css"><!--.STYLE1 {color: #FFFFFF}.STYLE2 {    color: #FF0000;    font-weight: bold;}--></style><h1>
<span class="action-span1">(<a href="tongji.php" style="color:#FF0000">到诊病人图表</a>) (<a href="tongji_yy.php" style="color:#9cacaf">预约病人图表</a>) (<a href="tongji_dj.php" style="color:#9cacaf">登记病人图表</a>)</span>  <div style="CLEAR: both"></div>
</h1><div class="form-div">  <form name="searchForm" action="" id="Form" method="get">    <img    style="max-width:90%" alt="SEARCH" src="images/start/icon_search.gif"  style="max-width:90%" border="0"> 到诊日期<span class="add2">            <input name="date1" type="text" id="date1" onfocus="setday(this)" size="15">            - </span><span class="add2">              <input name="date2" type="text" id="date2" onfocus="setday(this)" size="15">              </span>    <input name="submit2" type="submit" class="button" value=" 搜索 ">  </form>
</div>
getcount($str); //$sql = "select count(*) as `num`,`yydate`,`dzdate` from `yuyue` where `dzhen`=1 "; $sql = "select count(*) as `num`,`yydate`,`dzdate` from `yuyue` where `dzhen`=1 "; $sql = !empty($date1) ? $sql.dzdate($tt,$date1,$date2) : $sql; $sql = $sql." group by `dzdate` order by `dzdate` desc"; $sql2 = "select count(*) as `num`,`yydate`,`dzdate` from `yuyue` where `dzhen`=0 or `dzhen`=1 "; $sql2 = !empty($date1) ? $sql.yydate($tt,$date1,$date2) : $sql; $sql2 = $sql2." group by `dzdate` order by `dzdate` desc"; $result = $db->query($sql); $result2 = $db->query($sql2); while($rs = $db->fetch_array($result)){?>
到诊日期 星期 预约数量 到诊数量 未到诊数量
总数
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
이전 기사:function有关问题다음 기사:请求来解答