Wednesday, October 5, 2022
HomePHPThe right way to get knowledge from the database between two dates...

The right way to get knowledge from the database between two dates in PHP & MySQL


<?php require_once(“config.php”);

?>

<!DOCTYPE html>

<html lang=“en”>

<head>

<meta httpequiv=“content-type” content material=“textual content/html; charset=UTF-8”>

<meta charset=“utf-8”>

<title>PHP GURUKUL | DEMO</title>

<meta identify=“generator” content material=“Bootply” />

<meta identify=“viewport” content material=“width=device-width, initial-scale=1, maximum-scale=1”>

<hyperlink href=“https://phpgurukul.com/how-to-get-data-from-the-database-between-two-dates-in-php-mysql/css/bootstrap.min.css” rel=“stylesheet”>

<![if lt IE 9]>

<script src=“//html5shim.googlecode.com/svn/trunk/html5.js”></script>

<![endif]>

<hyperlink href=“css/types.css” rel=“stylesheet”>  

</head>

<physique>

<nav class=“navbar navbar-default navbar-fixed-top” position=“navigation”>

<div class=“navbar-header”>  

<h4 fashion=“padding-left: 100px;padding-top: 20px;”>PHP GURUKUL | Programming Weblog</h4>

</div>

</nav>

<div class=“container-fluid”>

  <!heart>

  <div class=“col-sm-8”>

    <div class=“row”>

      <div class=“col-xs-12”>

        <h3 fashion=“padding-left: 100px;”>How to get knowledge from database between two dates in php and MySQL</h3>

<hr >

<kind identify=“bwdatesdata” motion=“” methodology=“publish” motion=“”>

  <desk width=“100%” peak=“117”  border=“0”>

<tr>

<th width=“27%” peak=“63” scope=“row”>From Date :</th>

<td width=“73%”>

<enter sort=“date” identify=“fdate” class=“form-control” id=“fdate”>

     </td>

  </tr>

  <tr>

    <th width=“27%” peak=“63” scope=“row”>To Date :</th>

    <td width=“73%”>

    <enter sort=“date” identify=“tdate” class=“form-control” id=“tdate”></td>

  </tr>

<tr>

    <th width=“27%” peak=“63” scope=“row”></th>

    <td width=“73%”>

    <button class=“btn-primary btn” sort=“submit” identify=“submit”>Submit</button>

  </tr>

</desk>

     </kind>

      </div>

    </div>

    <hr>

      <div class=“row”>

      <div class=“col-xs-12”>

<?php

if(isset($_POST[‘submit’]))

{

$fdate=$_POST[‘fdate’];

$tdate=$_POST[‘tdate’];

?>

<h3 fashion=“padding-left: 100px;shade:blue”>Report from <?php echo $fdate?> to <?php echo $tdate?></h3>

<hr >

<div class=“row”>

<desk class=“desk table-bordered” width=“100%”  border=“0” fashion=“padding-left:40px”>

                                <thead>

                                    <tr>

                                        <th scope=“col”>S.NO</th>

                                        <th scope=“col”>Worker Title</th>

                                        <th scope=“col”>Division</th>

                                        <th scope=“col”>Cell Quantity</th>

                                        <th scope=“col”>E-mail</th>

                                        <th scope=“col”>Worker ID</th>

                                        <th scope=“col”>Becoming a member of Date</th>

                                    </tr>

                                </thead>

                                <?php

$ret=mysqli_query($con,“choose * from  tblempdata the place JoiningDate between ‘$fdate’ and ‘$tdate’ “);

$num=mysqli_num_rows($ret);

if($num>0){

$cnt=1;

whereas ($row=mysqli_fetch_array($ret)) {

?>

<tbody>

<tr knowledgeexpanded=“true”>

            <td><?php echo $cnt;?></td>

                  <td><?php  echo $row[‘EmployeeName’];?></td>

                  <td><?php  echo $row[‘Department’];?></td>

                  <td><?php  echo $row[‘MobileNumber’];?></td>

                  <td><?php  echo $row[‘Email’];?></td>

                  <td> <?php  echo $row[‘EmpID’];?></td>

                  <td><?php  echo $row[‘JoiningDate’];?></td>

                </tr>

                 <?php

$cnt=$cnt+1;

} } else { ?>

  <tr>

    <td colspan=“8”> No file discovered towards this dates</td>

 

  </tr>

<?php } }?>              

                                </tbody>

                            </desk>

                        </div>

      </div>

    </div>  

  </div><!/heart>

  <hr>

</div><!/containerfluid>

<! script references >

<script src=“//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js”></script>

<script src=“js/bootstrap.min.js”></script>

</physique>

</html>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments