我有两个文本框,第一个文本框用于开始日期,最后一个文本框用于结束日期。我想使用日期显示所有交易取决于用户输入。我在系统上使用Axios,Vue js和PHP。在我的函数中,我有一个参数为$transaction_date
。如何使用start_date和end_date来操纵事务表上的数据?有人可以帮我吗?这是我的查询和方法。
//FUNCTION
public function getAllStartEndDate($transaction_date) {
$sql="SELECT tbl_transaction_details.transaction_id,
tbl_supplier_medicine.medicine_name, tbl_category.description,
tbl_unit_category.unit, tbl_transaction_details.quantity,
tbl_supplier_medicine.price, tbl_transaction_details.total_price FROM
tbl_transaction_details INNER JOIN tbl_supplier_medicine ON
tbl_supplier_medicine.supplier_medicine_id =
tbl_transaction_details.supplier_medicine_id INNER JOIN tbl_category ON
tbl_category.category_id = tbl_supplier_medicine.category_id INNER JOIN
tbl_unit_category ON tbl_unit_category.unit_category_id =
tbl_supplier_medicine.unit_category_id INNER JOIN tbl_transaction ON
tbl_transaction.transaction_id = tbl_transaction_details.transaction_id
WHERE tbl_transaction.transaction_date >= :transaction_date AND
tbl_transaction.transaction_date <= :transaction_date";
$stmt = $this->connection->prepare($sql);
$stmt->execute([
":transaction_date" => $transaction_date
]);
}
//API
include '../../private/initialize.php';
$transaction_details = new Transaction_Details();
echo json_encode($transaction_details->getAllStartEndDate($_GET['keyword']));
//METHODS
searchByDate : function() {
axios.get(this.urlRoot + this.api +
"search_start_end_date_transaction.php?keyword=" +
this.start_date)
.then(function (response) {
vm.reports = response.data;
console.log(response);
});
}