从今天开始,如何在PHP PDO OOP中检索数据?

时间:2019-05-19 02:50:37

标签: php vue.js pdo axios

我正在尝试显示与今天的日期匹配的数据。我的页面上没有数据显示。我在Axios上使用PHP PDO。有人可以帮忙解决我的问题吗?

 public function retreiveDateToday() {
        $transaction_date = date("Y-m-d");

        $sql = "SELECT * FROM tbl_transaction WHERE datetime LIKE '%2019-05-19%'";

        $stmt = $this->connection->prepare($sql);

        $stmt->execute([
            ":transaction_id" => $transaction_id,
            ":beneficiary_id" => $beneficiary_id,
            ":user_id" => $user_id,
            ":transaction_date" => $transaction_date
        ]);

        return $stmt->fetchAll();
    }

VueJS方法

 retrieveReturnMedicine : function() {
        axios({
            method : "GET",
            url : this.urlRoot + "gulod/retrieve_date_today.php"
        }).then(function (response){
            vm.dateToday = response.data;
            console.log(response);
        });
    }

....

<?php

include '../../private/initialize.php';

$transaction = new Transaction();

echo json_encode($transaction->retreiveDateToday());

0 个答案:

没有答案