Home > Backend Development > PHP Tutorial > ,请问个php数据处理的有关问题

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

WBOY
Release: 2016-06-13 10:09:47
Original
914 people have browsed it

高手请进,请教个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` 
Copy after login



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>
Copy after login
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)){?>
到诊日期 星期 预约数量 到诊数量 未到诊数量
总数
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template