简体   繁体   English

如何使用PHP中的三个参数(date date,date to和input field)从mysql数据库获取结果

[英]how to get results from a mysql database using three parameters like (date from, date to and an input field ) in PHP

i want to retrieve data from mysql database table based on three input search parameters like date from , date to , and input text field like location , customer id . 我想基于三个输入搜索参数(例如date fromdate to和输入文本字段,例如locationcustomer id从mysql数据库表中检索数据。 Please provide some code how to do this? 请提供一些代码该怎么做?

Screen shot of table: 表格的屏幕截图:

在此处输入图片说明

Suppose you've stored the input prams in following variables... 假设您将输入婴儿车存储在以下变量中...

$date_from
$date_to
$location
$customer_id

and you have a table called customers, structured 您有一个名为客户的表,结构化

id name email location date_from date_to ID名称电子邮件位置date_from date_to

...you could then build your query like this: ...然后您可以像这样建立查询:

"SELECT * FROM customers where id = $customer_id AND location = '$location' AND date_from = $date_from AND date_to = $date_to";

PS: I had images disabled on my browser so I couldn't see the screenshot you posted, instead I just generated a table structure as an example. PS:我在浏览器上禁用了图像,所以我看不到您发布的屏幕截图,相反,我只是生成了一个表结构作为示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM