Pdo-两个日期之间的数据

时间:2018-12-19 15:43:15

标签: php database sqlite pdo

我正在用Php编写一个可移植的Web应用程序,并且正在将SQLite用于我的数据库。我想显示两个日期之间的日期差,但目前不起作用。 你能帮我吗? (我的英语不好,抱歉)。

我的代码:

<h3>Tarihe göre arama</h3>

    <form class="form-horizontal"  action="" method="post">                     
        <label>Tarih 1</label>
            <input type="text" class="form-control" name="tarih1" id="tarih1" value="<?php echo $buguntarih;?>" required>

        <label>Tarih 2</label>
            <input type="text" class="form-control" name="tarih2" id="tarih2" value="<?php echo $buguntarih;?>" required>

            <input type="submit"  value="Filtrele" name="filtrele" class="btn btn-primary  pull-right" style="background:none;">                                                        
    </form>

<?php 
    if($_POST['filtrele']){
        $tarih1=$_POST['tarih1'];
        $tarih2=$_POST['tarih2'];

        $query = $db->query("SELECT * FROM  islem where eklenme_tarihi between '{$tarih1}' and '{$tarih2}' and sirket_id={$sirketid} order by id ", PDO::FETCH_ASSOC);
    } else{
        $query = $db->query("SELECT * FROM  islem where sirket_id={$sirketid} order by id ", PDO::FETCH_ASSOC);
    }                                   
?>
<?php echo $sirket['sirket_adi']; ?></b> şirketine ait işlemler (

    <?php 

    if($_POST['filtrele']){ 
        echo "<b>".$tarih1."</b> ve <b>".$tarih2."</b> arası"; 
    } else{
        echo"tümü";
    } 
?>

0 个答案:

没有答案