Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 18.42 KB | None | 0 0
  1. <?php
  2.    
  3.     include ("include/check.php");
  4.     include ('function.php');
  5.    
  6.     if($role != 'admin')
  7.     {
  8.         header('Location: add/customer');
  9.     }
  10.    
  11.    
  12.    
  13.    
  14.  
  15.     $cby = $_GET['cby'];
  16.     $crequirment = $_GET['crequirment'];
  17.     $cdepartment = $_GET['cdepartment'];
  18.     $period = $_GET['period'];
  19.     $ccontact = $_GET['ccontact'];
  20.     $cattend = $_GET['cattend'];
  21.    
  22.    
  23.     if($period == "cw")
  24.     {
  25.         $d = strtotime("+1 week -1 day");
  26.         $start_week = strtotime("last saturday midnight",$d);
  27.         $end_week = strtotime("thursday",$d);
  28.         $start = date("Y-m-d",$start_week);
  29.         $end = date("Y-m-d",$end_week);
  30.     }else if($period == "lw")
  31.     {
  32.         $d = strtotime("today");
  33.         $start_week = strtotime("last saturday midnight",$d);
  34.         $end_week = strtotime("last thursday",$d);
  35.         $start = date("Y-m-d",$start_week);
  36.         $end = date("Y-m-d",$end_week);  
  37.     }else if($period == "lm")
  38.     {
  39.         $last_month_first_day=strtotime('first day of last month');
  40.         $date_value=$last_month_first_day;
  41.         $start = date('Y-m-d',$date_value);
  42.        
  43.         $last_month_last_day=strtotime('last day of last month');
  44.         $date_value2=$last_month_last_day;
  45.         $end = date('Y-m-d',$date_value2);
  46.     }else if($period == "pickdate")
  47.     {
  48.         $start = $_GET["from"];
  49.         $end = $_GET["to"];
  50.     }
  51.    
  52.    
  53.     if(
  54.     $cby == "none"
  55.     && $crequirment == "none"
  56.     && $cdepartment == "none"
  57.     && $period == "none"
  58.     && $ccontact == "none"
  59.     && $cattend == "none"
  60.     )
  61.     {
  62.         $query = mysqli_query($db, "SELECT * FROM customer");
  63.     }
  64.    
  65.    
  66.    
  67.     else if (
  68.     $cby != "none"
  69.     && $crequirment == "none"
  70.     && $cdepartment == "none"
  71.     && $period == "none"
  72.     && $ccontact == "none"
  73.     && $cattend == "none"
  74.     )
  75.     {
  76.         $query = mysqli_query($db, "SELECT * FROM customer WHERE cby = $cby");
  77.     }
  78.     else if (
  79.     $cby == "none"
  80.     && $crequirment == "none"
  81.     && $cdepartment != "none"
  82.     && $period == "none"
  83.     && $ccontact == "none"
  84.     && $cattend == "none")
  85.     {
  86.         $query = mysqli_query($db, "SELECT * FROM customer WHERE cdepartment = $cdepartment");
  87.     }
  88.     else if (
  89.     $cby == "none"
  90.     && $crequirment != "none"
  91.     && $cdepartment == "none"
  92.     && $period == "none"
  93.     && $ccontact == "none"
  94.     && $cattend == "none"
  95.     )
  96.     {
  97.         $query = mysqli_query($db, "SELECT * FROM customer WHERE crequirment = $crequirment");
  98.     }
  99.     else if (
  100.     $cby == "none"
  101.     && $crequirment == "none"
  102.     && $cdepartment == "none"
  103.     && $period != "none"
  104.     && $ccontact == "none"
  105.     && $cattend == "none")
  106.     {
  107.         $query = mysqli_query($db, "SELECT * FROM customer WHERE ctime BETWEEN '$start' AND '$end'");
  108.     }
  109.    
  110.     else if (
  111.     $cby == "none"
  112.     && $crequirment == "none"
  113.     && $cdepartment == "none"
  114.     && $period == "none"
  115.     && $ccontact != "none"
  116.     && $cattend == "none"
  117.     )
  118.     {
  119.         $query = mysqli_query($db, "SELECT * FROM customer WHERE ccontact = '$ccontact' ");
  120.     }
  121.     else if (
  122.     $cby == "none"
  123.     && $crequirment == "none"
  124.     && $cdepartment == "none"
  125.     && $period == "none"
  126.     && $ccontact == "none"
  127.     && $cattend != "none")
  128.     {
  129.         $query = mysqli_query($db, "SELECT * FROM customer WHERE cattend = '$cattend' ");
  130.     }
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.     // two fields set  
  138.    
  139.     else if (
  140.         $cby != "none"
  141.     && $crequirment != "none"
  142.     && $cdepartment == "none"
  143.     && $period == "none"
  144.     && $ccontact == "none"
  145.     && $cattend == "none"
  146.     )
  147.     {
  148.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  149.        
  150.         cby = $cby
  151.         AND
  152.         crequirment = $crequirment");
  153.     }  
  154.     else if (
  155.         $cby != "none"
  156.     && $crequirment == "none"
  157.     && $cdepartment != "none"
  158.     && $period == "none"
  159.     && $ccontact == "none"
  160.     && $cattend == "none"
  161.     )
  162.     {
  163.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  164.         cby = $cby
  165.         AND
  166.         cdepartment = $cdepartment");
  167.     }
  168.    
  169.     else if (
  170.         $cby != "none"
  171.     && $crequirment == "none"
  172.     && $cdepartment == "none"
  173.     && $period != "none"
  174.     && $ccontact == "none"
  175.     && $cattend == "none"
  176.     )
  177.     {
  178.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  179.         cby = $cby
  180.         AND
  181.         ctime BETWEEN '$start' AND '$end'");
  182.     }
  183.    
  184.     else if (
  185.         $cby != "none"
  186.     && $crequirment == "none"
  187.     && $cdepartment == "none"
  188.     && $period == "none"
  189.     && $ccontact != "none"
  190.     && $cattend == "none"
  191.     )
  192.     {
  193.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  194.         cby = $cby
  195.         AND
  196.         ccontact = '$ccontact'");
  197.     }
  198.     else if (
  199.         $cby != "none"
  200.     && $crequirment == "none"
  201.     && $cdepartment == "none"
  202.     && $period == "none"
  203.     && $ccontact == "none"
  204.     && $cattend != "none"
  205.     )
  206.     {
  207.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  208.         cby = $cby
  209.         AND
  210.         cattend = '$cattend'");
  211.     }
  212.  
  213.  
  214.  
  215.  
  216.    
  217.     else if (
  218.         $cby == "none"
  219.     && $crequirment != "none"
  220.     && $cdepartment != "none"
  221.     && $period == "none"
  222.     && $ccontact == "none"
  223.     && $cattend == "none"
  224.     )
  225.     {
  226.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  227.         crequirment = $crequirment
  228.         AND
  229.         cdepartment = $cdepartment");
  230.     }
  231.     else if (
  232.         $cby == "none"
  233.     && $crequirment != "none"
  234.     && $cdepartment == "none"
  235.     && $period != "none"
  236.     && $ccontact == "none"
  237.     && $cattend == "none"
  238.     )
  239.     {
  240.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  241.         crequirment = $crequirment
  242.         AND
  243.         ctime BETWEEN '$start' AND '$end'");
  244.     }
  245.     else if (
  246.         $cby == "none"
  247.     && $crequirment != "none"
  248.     && $cdepartment == "none"
  249.     && $period == "none"
  250.     && $ccontact != "none"
  251.     && $cattend == "none"
  252.     )
  253.     {
  254.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  255.         crequirment = $crequirment
  256.         AND
  257.         ccontact = '$ccontact'");
  258.     }
  259.     else if (
  260.         $cby == "none"
  261.     && $crequirment != "none"
  262.     && $cdepartment == "none"
  263.     && $period == "none"
  264.     && $ccontact == "none"
  265.     && $cattend != "none"
  266.     )
  267.     {
  268.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  269.         crequirment = $crequirment
  270.         AND
  271.         cattend = '$cattend'");
  272.     }
  273.  
  274.  
  275.  
  276.  
  277.     else if (
  278.         $cby == "none"
  279.     && $crequirment == "none"
  280.     && $cdepartment != "none"
  281.     && $period == "none"
  282.     && $ccontact == "none"
  283.     && $cattend != "none"
  284.     )
  285.     {
  286.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  287.         cdepartment = $cdepartment
  288.         AND
  289.         cattend = '$cattend'");
  290.     }
  291.     else if (
  292.         $cby == "none"
  293.     && $crequirment == "none"
  294.     && $cdepartment != "none"
  295.     && $period != "none"
  296.     && $ccontact == "none"
  297.     && $cattend == "none"
  298.     )
  299.     {
  300.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  301.         cdepartment = $cdepartment
  302.         AND
  303.         ctime BETWEEN '$start' AND '$end' ");
  304.     }
  305.     else if (
  306.         $cby == "none"
  307.     && $crequirment == "none"
  308.     && $cdepartment != "none"
  309.     && $period == "none"
  310.     && $ccontact != "none"
  311.     && $cattend == "none"
  312.     )
  313.     {
  314.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  315.         cdepartment = $cdepartment
  316.         AND
  317.         ccontact = '$ccontact'");
  318.     }
  319.    
  320.  
  321.  
  322.  
  323.     else if (
  324.         $cby == "none"
  325.     && $crequirment == "none"
  326.     && $cdepartment == "none"
  327.     && $period != "none"
  328.     && $ccontact != "none"
  329.     && $cattend == "none"
  330.     )
  331.     {
  332.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  333.         ctime BETWEEN '$start' AND '$end'  
  334.         AND
  335.         ccontact = '$ccontact'");
  336.     }
  337.     else if (
  338.         $cby == "none"
  339.     && $crequirment == "none"
  340.     && $cdepartment == "none"
  341.     && $period != "none"
  342.     && $ccontact == "none"
  343.     && $cattend != "none"
  344.     )
  345.     {
  346.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  347.         ctime BETWEEN '$start' AND '$end'  
  348.         AND
  349.         cattend = '$cattend'");
  350.     }
  351.     else if (
  352.         $cby == "none"
  353.     && $crequirment == "none"
  354.     && $cdepartment == "none"
  355.     && $period == "none"
  356.     && $ccontact != "none"
  357.     && $cattend != "none"
  358.     )
  359.     {
  360.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  361.         ccontact = '$ccontact'
  362.         AND
  363.         cattend = '$cattend'");
  364.     }
  365.  
  366.  
  367.  
  368.     else if (
  369.         $cby != "none"
  370.     && $crequirment != "none"
  371.     && $cdepartment != "none"
  372.     && $period == "none"
  373.     && $ccontact == "none"
  374.     && $cattend == "none"
  375.     )
  376.     {
  377.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  378.         cby = $cby
  379.         AND
  380.         crequirment = $crequirment
  381.         AND
  382.         cdepartment = $cdepartment");
  383.     }
  384.     else if (
  385.         $cby != "none"
  386.     && $crequirment != "none"
  387.     && $cdepartment == "none"
  388.     && $period != "none"
  389.     && $ccontact == "none"
  390.     && $cattend == "none"
  391.     )
  392.     {
  393.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  394.         cby = $cby
  395.         AND
  396.         crequirment = $crequirment
  397.         AND
  398.         ctime BETWEEN '$start' AND '$end'");
  399.     }
  400.     else if (
  401.         $cby != "none"
  402.     && $crequirment != "none"
  403.     && $cdepartment == "none"
  404.     && $period == "none"
  405.     && $ccontact != "none"
  406.     && $cattend == "none"
  407.     )
  408.     {
  409.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  410.         cby = $cby
  411.         AND
  412.         crequirment = $crequirment
  413.         AND
  414.         ccontact = '$ccontact'");
  415.     }
  416.     else if (
  417.         $cby != "none"
  418.     && $crequirment != "none"
  419.     && $cdepartment == "none"
  420.     && $period == "none"
  421.     && $ccontact == "none"
  422.     && $cattend != "none"
  423.     )
  424.     {
  425.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  426.         cby = $cby
  427.         AND
  428.         crequirment = $crequirment
  429.         AND
  430.         cattend = '$cattend'");
  431.     }
  432.     else if (
  433.         $cby != "none"
  434.     && $crequirment == "none"
  435.     && $cdepartment != "none"
  436.     && $period != "none"
  437.     && $ccontact == "none"
  438.     && $cattend == "none"
  439.     )
  440.     {
  441.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  442.         cby = $cby
  443.         AND
  444.         cdepartment = $cdepartment
  445.         AND
  446.         ctime BETWEEN '$start' AND '$end'");
  447.     }
  448.  
  449.     else if (
  450.         $cby != "none"
  451.     && $crequirment == "none"
  452.     && $cdepartment != "none"
  453.     && $period == "none"
  454.     && $ccontact != "none"
  455.     && $cattend == "none"
  456.     )
  457.     {
  458.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  459.         cby = $cby
  460.         AND
  461.         cdepartment = $cdepartment
  462.         AND
  463.         ccontact = '$ccontact'");
  464.     }
  465.  
  466.     else if (
  467.         $cby != "none"
  468.     && $crequirment == "none"
  469.     && $cdepartment != "none"
  470.     && $period == "none"
  471.     && $ccontact == "none"
  472.     && $cattend != "none"
  473.     )
  474.     {
  475.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  476.         cby = $cby
  477.         AND
  478.         cdepartment = $cdepartment
  479.         AND
  480.         cattend = '$cattend'");
  481.     }
  482.  
  483.     else if (
  484.         $cby != "none"
  485.     && $crequirment == "none"
  486.     && $cdepartment == "none"
  487.     && $period != "none"
  488.     && $ccontact != "none"
  489.     && $cattend == "none"
  490.     )
  491.     {
  492.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  493.         cby = $cby
  494.         AND
  495.         ccontact = '$ccontact'
  496.         AND
  497.         ctime BETWEEN '$start' AND '$end'");
  498.     }  
  499.    
  500.     else if (
  501.         $cby != "none"
  502.     && $crequirment == "none"
  503.     && $cdepartment == "none"
  504.     && $period != "none"
  505.     && $ccontact == "none"
  506.     && $cattend != "none"
  507.     )
  508.     {
  509.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  510.         cby = $cby
  511.         AND
  512.         cattend = '$cattend'
  513.         AND
  514.         ctime BETWEEN '$start' AND '$end'");
  515.     }
  516.  
  517.     else if (
  518.         $cby != "none"
  519.     && $crequirment == "none"
  520.     && $cdepartment == "none"
  521.     && $period != "none"
  522.     && $ccontact == "none"
  523.     && $cattend != "none"
  524.     )
  525.     {
  526.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  527.         cby = $cby
  528.         AND
  529.         cattend = '$cattend'
  530.         AND
  531.         ccontact = '$ccontact'");
  532.     }
  533.  
  534.    
  535.    
  536.    
  537.     --------------------------------------
  538.    
  539.    
  540.    
  541.    
  542.    
  543.    
  544.    
  545.    
  546.     else if (
  547.         $cby == "none"
  548.     && $crequirment != "none"
  549.     && $cdepartment != "none"
  550.     && $period != "none"
  551.     && $ccontact == "none"
  552.     && $cattend == "none"
  553.     )
  554.     {
  555.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  556.         ctime BETWEEN '$start' AND '$end'
  557.         AND
  558.         crequirment = $crequirment
  559.         AND
  560.         cdepartment = $cdepartment");
  561.     }
  562.     else if (
  563.         $cby == "none"
  564.     && $crequirment != "none"
  565.     && $cdepartment != "none"
  566.     && $period != "none"
  567.     && $ccontact == "none"
  568.     && $cattend == "none"
  569.     )
  570.     {
  571.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  572.         ccontact = '$ccontact'
  573.         AND
  574.         crequirment = $crequirment
  575.         AND
  576.         cdepartment = $cdepartment");
  577.     }
  578.     else if (
  579.         $cby == "none"
  580.     && $crequirment != "none"
  581.     && $cdepartment != "none"
  582.     && $period != "none"
  583.     && $ccontact == "none"
  584.     && $cattend == "none"
  585.     )
  586.     {
  587.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  588.         cattend = '$cattend'
  589.         AND
  590.         crequirment = $crequirment
  591.         AND
  592.         cdepartment = $cdepartment");
  593.     }
  594.    
  595.    
  596.    
  597.  
  598.     else if (
  599.         $cby == "none"
  600.     && $crequirment != "none"
  601.     && $cdepartment != "none"
  602.     && $period != "none"
  603.     && $ccontact == "none"
  604.     && $cattend == "none"
  605.     )
  606.     {
  607.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  608.         ccontact = '$ccontact'
  609.         AND
  610.         ctime BETWEEN '$start' AND '$end'
  611.         AND
  612.         cdepartment = $cdepartment");
  613.     }
  614.     else if (
  615.         $cby == "none"
  616.     && $crequirment != "none"
  617.     && $cdepartment != "none"
  618.     && $period != "none"
  619.     && $ccontact == "none"
  620.     && $cattend == "none"
  621.     )
  622.     {
  623.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  624.         cattend = '$cattend'
  625.         AND
  626.         ctime BETWEEN '$start' AND '$end'
  627.         AND
  628.         cdepartment = $cdepartment");
  629.     }
  630.  
  631.    
  632.    
  633.     else if (
  634.         $cby == "none"
  635.     && $crequirment != "none"
  636.     && $cdepartment != "none"
  637.     && $period != "none"
  638.     && $ccontact == "none"
  639.     && $cattend == "none"
  640.     )
  641.     {
  642.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  643.         cattend = '$cattend'
  644.         AND
  645.         ctime BETWEEN '$start' AND '$end'
  646.         AND
  647.         ccontact = '$ccontact'");
  648.     }
  649.    
  650.    
  651.    
  652.  
  653.     else if (
  654.         $cby != "none"
  655.     && $crequirment != "none"
  656.     && $cdepartment != "none"
  657.     && $period != "none"
  658.     && $ccontact == "none"
  659.     && $cattend == "none"
  660.     )
  661.     {
  662.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  663.         cby = $cby
  664.         AND
  665.         crequirment = crequirment
  666.         AND
  667.         cdepartment = cdepartment
  668.         AND
  669.         ctime BETWEEN '$start' AND '$end'");
  670.     }
  671.  
  672.     else if (
  673.         $cby != "none"
  674.     && $crequirment != "none"
  675.     && $cdepartment != "none"
  676.     && $period == "none"
  677.     && $ccontact != "none"
  678.     && $cattend == "none"
  679.     )
  680.     {
  681.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  682.         cby = $cby
  683.         AND
  684.         crequirment = crequirment
  685.         AND
  686.         cdepartment = cdepartment
  687.         AND
  688.         ccontact = '$ccontact'
  689.         ");
  690.     }
  691.     else if (
  692.         $cby != "none"
  693.     && $crequirment != "none"
  694.     && $cdepartment != "none"
  695.     && $period == "none"
  696.     && $ccontact == "none"
  697.     && $cattend != "none"
  698.     )
  699.     {
  700.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  701.         cby = $cby
  702.         AND
  703.         crequirment = crequirment
  704.         AND
  705.         cdepartment = cdepartment
  706.         AND
  707.         cattend = '$cattend'
  708.         ");
  709.     }
  710.  
  711.  
  712.  
  713.  
  714.     else if (
  715.         $cby == "none"
  716.     && $crequirment != "none"
  717.     && $cdepartment != "none"
  718.     && $period != "none"
  719.     && $ccontact != "none"
  720.     && $cattend == "none"
  721.     )
  722.     {
  723.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  724.         crequirment = crequirment
  725.         AND
  726.         cdepartment = cdepartment
  727.         AND
  728.         ctime BETWEEN '$start' AND '$end'
  729.         AND
  730.         ccontact = '$ccontact'
  731.         ");
  732.     }
  733.     else if (
  734.         $cby == "none"
  735.     && $crequirment != "none"
  736.     && $cdepartment != "none"
  737.     && $period != "none"
  738.     && $ccontact == "none"
  739.     && $cattend != "none"
  740.     )
  741.     {
  742.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  743.         crequirment = crequirment
  744.         AND
  745.         cdepartment = cdepartment
  746.         AND
  747.         ctime BETWEEN '$start' AND '$end'
  748.         AND
  749.         cattend = '$cattend'
  750.         ");
  751.     }
  752.    
  753.  
  754.  
  755.     else if (
  756.         $cby == "none"
  757.     && $crequirment == "none"
  758.     && $cdepartment != "none"
  759.     && $period == "none"
  760.     && $ccontact != "none"
  761.     && $cattend != "none"
  762.     )
  763.     {
  764.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  765.         cdepartment = cdepartment
  766.         AND
  767.         cattend = '$cattend'
  768.         AND
  769.         ccontact = '$ccontact'
  770.         ");
  771.     }
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.     else if (
  779.         $cby != "none"
  780.     && $crequirment != "none"
  781.     && $cdepartment != "none"
  782.     && $period != "none"
  783.     && $ccontact != "none"
  784.     && $cattend == "none"
  785.     )
  786.     {
  787.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  788.         cby = $cby
  789.         AND
  790.         crequirment = $crequirment
  791.         AND
  792.         cdepartment = cdepartment
  793.         AND
  794.         ctime BETWEEN '$start' AND '$end'
  795.         AND
  796.         ccontact = '$ccontact'
  797.         ");
  798.     }
  799.     else if (
  800.         $cby != "none"
  801.     && $crequirment != "none"
  802.     && $cdepartment != "none"
  803.     && $period != "none"
  804.     && $ccontact == "none"
  805.     && $cattend != "none"
  806.     )
  807.     {
  808.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  809.         cby = $cby
  810.         AND
  811.         crequirment = $crequirment
  812.         AND
  813.         cdepartment = cdepartment
  814.         AND
  815.         ctime BETWEEN '$start' AND '$end'
  816.         AND
  817.         cattend = '$cattend'
  818.         ");
  819.     }
  820.  
  821.  
  822.  
  823.     else if (
  824.         $cby != "none"
  825.     && $crequirment != "none"
  826.     && $cdepartment != "none"
  827.     && $period != "none"
  828.     && $ccontact != "none"
  829.     && $cattend != "none"
  830.     )
  831.     {
  832.         $query = mysqli_query($db, "SELECT * FROM customer WHERE
  833.         cby = $cby
  834.         AND
  835.         crequirment = $crequirment
  836.         AND
  837.         cdepartment = cdepartment
  838.         AND
  839.         ctime BETWEEN '$start' AND '$end'
  840.         AND
  841.         cattend = '$cattend'
  842.         AND
  843.         ccontact = '$ccontact'
  844.         ");
  845.     }
  846.  
  847.  
  848.    
  849.    
  850.    
  851.        
  852.     else
  853.     {
  854.         echo "Nothing Found";
  855.     }
  856.  
  857.  
  858. ?>
  859. <!doctype html>
  860. <html>
  861. <head>
  862. <meta charset="utf-8">
  863. <title>Untitled Document</title>
  864. </head>
  865.  
  866. <body>
  867.  
  868. <div align="right">
  869. <table width="250px" border="1" cellpadding="5" cellspacing="5" style="border-collapse: collapse; margin-bottom:20px;">
  870.   <tbody>
  871.     <tr>
  872.       <td width="150px" bgcolor="#000000" style="color: #FFFFFF;"><strong>Total Records</strong></td>
  873.       <td><?php echo mysqli_num_rows($query); ?></td>
  874.     </tr>
  875.   </tbody>
  876. </table>
  877. </div>
  878.  
  879.  
  880. <table width="100%" border="1" cellpadding="5" cellspacing="5" style="border-collapse: collapse;">
  881.   <tbody>
  882.     <tr>
  883.       <td width="8%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Username</strong></td>
  884.       <td width="13%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Customer Name</strong></td>
  885.       <td width="10%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Number</strong></td>
  886.       <td width="12%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Email</strong></td>
  887.       <td width="15%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Department</strong></td>
  888.       <td width="15%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Requirement</strong></td>
  889.       <td width="11%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Contact Source</strong></td>
  890.       <td width="5%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Ph. Attnd</strong></td>
  891.       <td width="12%" bgcolor="#000000" style="color: #FFFFFF;"><strong>Date</strong></td>
  892.     </tr>
  893.  
  894. <?php
  895. if (mysqli_num_rows($query) > 0) {
  896.     // output data of each row
  897.    
  898.     $count = 1;
  899.     while($row = mysqli_fetch_assoc($query)) {
  900. ?>
  901.     <tr>
  902.       <td><?php echo username($row['cby']); ?></td>
  903.       <td><?php echo $row['cname'];?></td>
  904.       <td><?php echo $row['cnumber']?></td>
  905.       <td><?php echo $row['cemail'];?></td>
  906.       <td><?php echo departmentname($row['cdepartment']);?></td>
  907.       <td><?php echo requirements($row['crequirment']);?></td>
  908.       <td><?php echo $row['ccontact'];?></td>
  909.       <td><?php echo $row['cattend'];?></td>
  910.       <td><?php echo $row['ctime'];?></td>
  911.     </tr>
  912. <?php } }else
  913. {
  914.     echo mysqli_error($db);
  915. }?>
  916.   </tbody>
  917. </table>
  918.  
  919. </body>
  920. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement