To query the date range, you can view the data of yesterday after you open the webpage by default.
You can also enter the date and time to query in the text box
The code I wrote is as follows:
$ Mindate = $ _ GET ['mindate']; $ maxdate = $ _ GET ['maxdate']; $ SQL = "SELECT * from 'khxx' where $ mindate and $ maxdate ";
There are two problems
1. The result is not directly queried based on the content of the text box.
2. because the value content is defined in the input, although the value in the text box is returned after the data is submitted by another date point.
Reply to discussion (solution)
Apparently, your SQL statement is wrong.
$ Mindate = isset ($ _ GET ['mindate'])? $ _ GET ['mindate']: date ("Y-m-d", strtotime ("-1 day ")); $ maxdate = isset ($ _ GET ['maxdate'])? $ _ GET ['maxdate']: date ("Y-m-d", strtotime ("-1 day "));
$ SQL = "SELECT * from 'khxx' where $ mindate and $ maxdate"; problem.
If the date field of your database is addtime, write it like this
$ SQL = "SELECT * from 'khxx' where addtime> '". $ mindate. "' and addtime <'". $ maxdate ."'";