Php searches for order data based on the input start time and end time

Source: Internet
Author: User
Php searches for order data based on the input start time and end time & lt; form & nbsp; nameform2 & nbsp; methodget & nbsp; actionshops_operations.php & gt; & nbsp; & lt; input & nbsp; namestarttime & nbsp; typetext & nbsp; idstarttime php searches for order data based on the input start time and end time
  
  





The database table name is dede_shops_orders, and the time field is stime (int type). It has been converted to time data. it is displayed:; the control is ready and you want to search based on the time data of the two inputs, how to deal with PHP pages!
------ Solution ----------------------
Where interval query in select,> and <
------ Solution ----------------------
The shops_operations.php page writes an SQL statement based on the input start time $ startTime and end time $ endTime.
Select * from dede_shops_orders where 'stime' between $ startTime and $ endTime.
First, convert the start time and end time to an integer.
------ Solution ----------------------
Reference:
Quote: reference:

Quote: reference:

The shops_operations.php page writes an SQL statement based on the input start time $ startTime and end time $ endTime.
Select * from dede_shops_orders where 'stime' between $ startTime and $ endTime.
First, convert the start time and end time to an integer.

// Query order time
$ T1 = $ _ POST ['starttime']; // start time
$ T2 = $ _ POST ['endtime']; // end time
// Var_dump ($ t1 );
// Die;
$ SQL = "select * from dede_shops_orders where 'stime' between $ startTime and $ endTime .";
$ Result = mysql_query ($ SQL );
While ($ row = mysql_fetch_row ($ result )){
Echo $ row [0]. ''. $ row [1].'
';
}
Now, this stime database is 140551515 processed using functions... What should I do next?
$ SQL = "select * from dede_shops_orders where 'stime' between $ t1and $ t2.

This is the result of searching by start time and end time.
------ Solution ----------------------
You printed $ t1 $ t2 and the stime field stored in the database. what is it like?
------ Solution ----------------------
... You can see the problem. your form is submitted in get mode. $ _ POST is used when you get the value. The value cannot be obtained.
------ Solution ----------------------
Method = "get" to method = "post"
------ Solution ----------------------
The proportion must be in the same format. Since the time saved in your database is int, the time condition is also converted to int for comparison.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.