, ask a question about PHP data processing

Source: Internet
Author: User
Tags date1 php and mysql
Master please come in, ask a PHP data processing problems
Use PHP and MySQL to achieve a patient appointment statistics function:
When the page is loaded by default, all incoming data is displayed, and you can search by entering the date of the consultation:
Now to implement this function to how to implement, the following code is I now implement the part, may not be written correctly, please help to achieve this function.


MySQL data table structure CREATE table ' Yuyue ' (
' id ' int (one) not NULL auto_increment, ' ID autonumber
' Fangshi ' varchar default NULL, ' reservation method: divided into network and telephone
' yydate ' varchar (+) default NULL, ' appointment date
' djdate ' varchar (+) default NULL, ' Date of registration '
' Dzhen ' int (one) default ' 0 ', ' whether to: 0 also, 1 is
' dzdate ' varchar (+) default NULL, ' Date of appointment
PRIMARY KEY (' id ')
) Engine=myisam auto_increment=2333 DEFAULT Charset=utf8;


function.inc.php
PHP Code
  
   
  
   = ' $date 1 ' and ' dzdate ' <= ' $date 2 ' ";        }        if (!empty ($date 1) && empty ($date 2)) {            $sql = $sql. "and ' dzdate ' = ' $date 1 '";            }        if (Empty ($date 1) &&!empty ($date 2)) {            $sql = $sql. "And ' dzdate ' <= ' $date 2 '";            }        return $sql;    }



PHP Code
  
  

(to the Consultation person chart) (Book a Patient chart) (Registered patient chart)

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 ($date 1)? $sql. Dzdate ($tt, $date 1, $date 2): $sql; $sql = $sql. " GROUP BY ' dzdate ' ORDER by ' dzdate ' desc; $sql 2 = "SELECT COUNT (*) as ' num ', ' yydate ', ' dzdate ' from ' Yuyue ' where ' dzhen ' =0 or ' dzhen ' = 1"; $sql 2 =!empty ($date 1)? $sql. Yydate ($tt, $date 1, $date 2): $sql; $sql 2 = $sql 2. " GROUP BY ' dzdate ' ORDER by ' dzdate ' desc; $result = $db->query ($sql); $result 2 = $db->query ($sql 2); while ($rs = $db->fetch_array ($result)) {?>
date of the appointment Week Number of appointments number of visits to the clinic the number of missed appointments
Total human person
human person
human person
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.